[jboss-user] [EJB 3.0] - Re: How to retrieve an EJB from a JAR used in many EAR ?

jaikiran do-not-reply at jboss.com
Wed Mar 12 06:25:34 EDT 2008

You can create a jboss.xml file and mention the jndi-name of your choice for the EJB. Something like this:

<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
  | <jboss>
  |     <enterprise-beans>
  |       <session>
  |          <ejb-name>ServiceEmployeBean</ejb-name>
  |          <jndi-name>MyBean</jndi-name>
  |       </session>
  |    </enterprise-beans>
  | </jboss>

Place this jboss.xml in the META-INF folder of your ejb jar (same place as ejb-jar.xml). Then use this jndi-name (in this case "MyBean") in your code, to lookup the bean.

P.S: You mentioned that you use EJB3. In EJB3 you no longer need the xmls to define the beans or the jndi-name. You can use annotations to do this. See this EJBTrail for more details http://trailblazer.demo.jboss.com/EJB3Trail/

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

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

More information about the jboss-user mailing list