[jboss-user] [EJB 3.0] - How to retrieve an EJB from a JAR used in many EAR ?
chawax
do-not-reply at jboss.com
Wed Mar 12 06:11:32 EDT 2008
Hi,
I work with EJB3 (I am a newbie) and I have problems about state of the art way to retrieve an EJB from a JAR that will be used on many EAR projects.
I have the following EJB (generated from AndroMDA) :
<session>
| <description>
| <![CDATA[
|
| ]]>
| </description>
| <ejb-name>ServiceEmployeBean</ejb-name>
| <remote>myCompany.ServiceEmployeRemote</remote>
| <ejb-class>myCompany.ServiceEmployeBean</ejb-class>
| <session-type>Stateless</session-type>
| <transaction-type>Container</transaction-type>
| </session>
My JAR contains Seam pojo classes that need to retrieve this EJB. I could do it this way :
protected ServiceAbsenceRemote getServiceAbsence() throws Exception
| {
| if (this.serviceAbsence == null) {
| InitialContext initialContext = new InitialContext();
| this.serviceAbsence = (ServiceAbsenceRemote)
| initialContext.lookup("t4-ihm-self-ear-1.0-SNAPSHOT/ServiceAbsenceBean/remote");
| }
| return this.serviceAbsence;
| }
As you can see, the problem is that I need to prefix the EJB name with the EAR name. If I don't do that I have a "ServiceAbsenceBean" not bound message. So it looks like this JAR can be used only in one EAR and I ask myself how it could work in another EAR ?
I am sure I do something wrong, so please tell me ;)
Thanks in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135863#4135863
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135863
More information about the jboss-user
mailing list