[jboss-user] [EJB 3.0] - Re: Same JNDI name in multiple EAR files: mix up?

Wolfgang Knauf do-not-reply at jboss.com
Thu May 10 12:14:27 EDT 2007


Hi !

I hope I understand your problem, and I hope I can provide some help  ;-).

You have deployed the same bean in different ejb JARs, but your client lookup does not seem to find the bean which "belongs" to it ? 
I thought this should not be possible at all ;-).

Well, you can control the JNDI names with jboss specific deployment descriptors. 
For each bean in an EJB jar you can specifiy to which JNDI name it should be bound:

<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE jboss PUBLIC
  | 	"-//JBoss//DTD JBOSS 4.2//EN"
  | 	"http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">
  | <jboss>
  | 	<enterprise-beans>
  | 		<session>
  | 			<ejb-name>DataManagerBean</ejb-name>
  | 			<jndi-name>DataManager1</jndi-name>
  | 			<local-jndi-name>DataManager1Local</local-jndi-name>
  | 		</session>
  | 	</enterprise-beans>
  | </jboss> 

This will redefine the global JNDI name of the bean (defaults to EARName/EJBName/local).

On the client side, an ENC entry will be defined in jboss-web.xml and references the new JNDI name:

<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE jboss-web PUBLIC
  |     "-//JBoss//DTD Web Application 4.2//EN"
  |     "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
  | <jboss-web>
  | 	<context-root>...</context-root>
  | 	<ejb-ref>
  | 		<ejb-ref-name>ejb/DataManagerBean</ejb-ref-name>
  | 		<jndi-name>DataManager1</jndi-name>
  | 	</ejb-ref>
  | </jboss-web>

Hope this helps !

Wolfgang 

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

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



More information about the jboss-user mailing list