The Source for Java Technology Collaboration

Home » java.net Forums » GlassFish » GlassFish

Thread: How to access EJB bean from war application deployed as separate modules

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is answered.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 2 - Last Post: Oct 25, 2007 11:29 PM by: remisb
remisb

Posts: 4
How to access EJB bean from war application deployed as separate modules
Posted: Oct 25, 2007 5:30 AM
 
  Click to reply to this thread Reply

Hi

I have developed an ejb session bean and deployed it in separate ejb.jar. I also have a web application which uses ejb session bean through Remote interface. When I'm deploying it as ear everything works without any problem.

Question is. How can I access ejb bean from war application without deploying ejb.jar and web.war together in one ear.

I would like to have 3-5 separate ejb.jar and 2 .war applications with access to ejb session beans from those separate ejb.jar's.

Any link to information, sample or suggestions are greatly welcomed.

Thanks in advance
Remis B.

ksak

Posts: 455
Re: How to access EJB bean from war application deployed as separate modules
Posted: Oct 25, 2007 6:59 AM   in response to: remisb
Correct
  Click to reply to this thread Reply

This EJB FAQ entry describes how to map a remote EJB dependency to a target bean.

https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#mappingRemoteejbdependency

remisb

Posts: 4
Re: How to access EJB bean from war application deployed as separate module
Posted: Oct 25, 2007 11:29 PM   in response to: ksak
 
  Click to reply to this thread Reply

Thanks for answer.

BTW I managed to find solution before receiving your responce. One thing that was causing problem is misunderstanding the difference between JNDI global and environment naming context. As I have noticed this part is least covered in EJB3 related books, articles and tutorials. All these sources are more focused on simple scenarios without paying enough attention to cases I have.

Solution I come with is by putting mappedName attribute in Stateless annotation on EJB.
@Stateless(name="CountryBean", mappedName="ejb/Country")

also putting "ejb/" as prefix for mapped name automatically places it int "ejb/" jndi tree node in glassfish web admin's "Jndi tree browsing" window.

Also would like to pay attention in separating API classes from EJB implementation classes, and issues related with separate deployment of EJB, rar and war modules without putting them together in single ear. All samples I have red is leaving that question aside without bothering about covering this issue. Also there is not enough information about real deployment, updating, management strategies and issues.

If someone can provide links to information about issues listed above I'll be very thankful.

Regards Remis B




 XML java.net RSS