This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes EJB and other Java EE Technologies and the fly likes Access EJB from different EAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Access EJB from different EAR" Watch "Access EJB from different EAR" New topic
Author

Access EJB from different EAR

Mukesh Mittal
Ranch Hand

Joined: Jan 13, 2006
Posts: 31
Hi

If I have two EAR file. I want to acess EJB of Ear 1 from web application of EAR2. Can we do it? Do we have J2EE standard for that? Is it Servler specific?

Thanks
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
You can't use EJB linking in the deployment descriptor, but they can still talk to each other. Not sure if local interfaces would work (never tried it across ears) but remote interfaces and JMS-based communications would definitely work.


Reid - SCJP2 (April 2002)
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
The J2EE standard is that the client obtains an InitialContext (needs to pass in the right environment variables into the constructor) and uses it to do a JNDI lookup of the EJB's home. You are now on the home straight. (Sorry, bad joke. :roll: ) The stub returned needs to be narrowed and cast to the EJB's home interface. For a stateless session bean, the home stub is then used to obtain the remote EJB object stub (used to call business methods).


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Access EJB from different EAR