This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet as a Local Client ?

 
Vijay Pawar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Can a servlet or a java application be a local client to a session/entity bean ? Or is it necessary that only an EJB can be a local client to another EJB ?
Thanks in advance.
Jughead
 
Janne Karhu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To my knowledge, everything residing in the same JVM than the bean can access the bean through local interfaces. Thus the answer is "yes".
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jughead
Servlets can be a local client but I dont think a Java application can be. Servlet can be as we can put ejb-reference in web.xml and use jndi-name to lookup the bean but in java application we can't do it...
Thanks
Maulin
 
Vijay Pawar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Maulin,
I think you are right. If we create a ear file on Websphere or Weblogic, the ear file can contain web components (jsp and servlets) which i believe would be run in the same container.
But can we be sure that the server vendors would be having a common jvm for the ejb container and the web container or would it be different jvms?
By the way, maulin, do you know if an Indian Reprint of the most famous book on SCJP certification by "Kathy Sierra & Bert Bates" ( Publisher - Osborne) is available ?
Do we have a low cost Indian version of this book ?
Thanks a lot
Jughead
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jughead:
But can we be sure that the server vendors would be having a common jvm for the ejb container and the web container or would it be different jvms?

That is an interesting question :roll:
By the way, maulin, do you know if an Indian Reprint of the most famous book on SCJP certification by "Kathy Sierra & Bert Bates" ( Publisher - Osborne) is available ?
- Yes, it is available. It is one of the best selling java books in India. Check out ur local computer shop.
 
Vijay Pawar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Vish
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jughead
Unfortunately, I didn't know answer for any of the two questions you asked latest Glad, that Vish could help.
I assured that we need to have ejb-ref specified, whether we want to use a bean from another bean or servlet. So a stand alone application having "public static void main" things can't really use the beans.
Now, I am not sure what would happen if we have two JVMs, one for ejbs and one for webapp, running on the same machine. I would expect that we are still able to work with local interfaces as far as we are on same machine but I am not sure. I am investigating this. I myself have many doubts but still not got a chance to perform enough tests....
Regards
Maulin
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by,

"public static void main" things can't really use the beans.

i mean using java:comp/env/ejb way applications can't...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic