Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Access EJB from different EAR

 
Mukesh Mittal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic