[jboss-user] [JNDI and Naming] - ejb-ref lookup does not work in JBoss 4.2.0.GA_CP07

ghepardo do-not-reply at jboss.com
Thu Sep 10 08:58:27 EDT 2009


Hi,
I am using JBoss 4.2.0.GA_CP07 with ear-isolation = true and call-by-value=false

I have the following situation:

ejb A needs to call ejb B, and both are in different isolated EARs.

To do this, as stated on the JBoss community wiki's:

http://www.jboss.org/community/wiki/classloadingconfiguration

I have to configure ejb-jar.xml and jboss.xml of ejb A with  references to ejb b.

So, these are my configuration files:
ejb A = TISService
ejb B = GTSService

ejb-jar.xml of ejb A

  | ...
  | <enterprise-beans>
  | 		<session>
  | 			<display-name>TISService</display-name>
  | 			<ejb-name>TISService</ejb-name>
  | 			<home>it.ltm.ca.tis.session.TISServiceHome</home>
  | 			<remote>it.ltm.ca.tis.session.TISServiceRemote</remote>
  | 			<local-home>it.ltm.ca.tis.session.TISServiceLocalHome</local-home>
  | 			<local>it.ltm.ca.tis.session.TISServiceLocal</local>
  | 			<ejb-class>it.ltm.ca.tis.session.TISServiceBean</ejb-class>
  | 			<session-type>Stateless</session-type>
  | 			<transaction-type>Container</transaction-type>
  | 
  | 			<!-- RIFERIMENTO AL GTS -->
  | 			<ejb-local-ref>
  | 				<ejb-ref-name>ejb/KCP_GTSServiceLocalReference</ejb-ref-name>
  | 				<ejb-ref-type>Session</ejb-ref-type>
  | 				<local-home>it.ltm.kcp.gts.session.GTSServiceLocalHome</local-home>
  | 				<local>it.ltm.kcp.gts.session.GTSServiceLocal</local>
  | 			</ejb-local-ref>
  | 			
  | 		</session>
  | ...
  | [/CODE]
  | 
  | jboss.xml of ejb A
  | [CODE]
  | ...
  | <jboss>
  | 	<enterprise-beans>
  | 		<session>
  | 			<ejb-name>TISService</ejb-name>
  | 			<jndi-name>ejb/TISService</jndi-name>
  | 			<local-jndi-name>java:/ejb/TISService</local-jndi-name>
  | 			
  | 			<!-- RIFERIMENTO AL GTS -->
  | 			<ejb-local-ref>
  | 				<ejb-ref-name>ejb/KCP_GTSServiceLocalReference</ejb-ref-name>
  | 				<local-jndi-name>java:/ejb/KCP_GTSService</local-jndi-name>
  | 			</ejb-local-ref>			
  | 		</session>
  | ...
  | 


This is the code I am using to lookup ejb B from a class in ejb A (taken from an example in the JBoss UserGuide):


  | Context ctx = (Context) new InitialContext().lookup("java:comp/env"
  | GTSServiceLocalHome local = (GTSServiceLocalHome) ctx.lookup("ejb/KCP_GTSServiceLocalReference"); //I am using the <ejb-ref-name> as the lookup String.
  | GTSService instance = local.create();
  | 

The problem is that the lookup of the ejb-ref fails.

If I try to lookup the JNDI name of the EJB, the lookup succeed, but the create fails with "Invalid invocation, check your deployment..." because it is trying to create an instance of ejb B that is in an isolated ear.

Can someone help me?

Why the lookup of the ejb-ref-name fails? 
The main problem is that the ejb-ref-name (ie: ejb/KCP_GTSServiceLocalReference)
is present in the JNDI Tree:

  | Ejb Module: CA_TerminalInteractionSystemEJB.jar
  | 
  | java:comp namespace of the TISService bean:
  | 
  |   +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
  |   +- ORB (class: org.jacorb.orb.ORB)
  |   +- env (class: org.jnp.interfaces.NamingContext)
  |   |   +- ejb (class: org.jnp.interfaces.NamingContext)
  |   |   |   +- KCP_GTSServiceReference[link -> ejb/KCP_GTSService] (class: javax.naming.LinkRef)
  |   |   |   +- KCP_GTSServiceLocalReference[link -> java:/ejb/KCP_GTSService] (class: javax.naming.LinkRef)
  | 

I hope to get an answer, I am really blocked here. Thanks

Thanks.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4254439#4254439

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4254439



More information about the jboss-user mailing list