2 Replies Latest reply on Jul 28, 2003 11:37 PM by theactionboy

    Multiple EARs containing the same EJBs

      We've reused common EJBs (such as a User component) between applications that we've packaged as EARs.

      How do we bind our EJBs in the JNDI tree such that the same EJB from two different EARs don't attempt to bind in the same place in the tree?

      At the moment my jboss.xml looks like this:


      <enterprise-beans>

      <ejb-name>User</ejb-name>
      <local-jndi-name>User</local-jndi-name>


      <ejb-name>UserManager</ejb-name>
      <jndi-name>user/UserManager</jndi-name>
      <resource-ref>
      <res-ref-name>jdbc/userDS</res-ref-name>
      <jndi-name>java:/myappDS</jndi-name>
      </resource-ref>

      </enterprise-beans>


      When the second application deploys, I get errors that User is already bound.

      Is it possible to have a separate space in the tree for each application? Can this be done automatically?

      As part of our build with XDoclet, we can customise where things bind to (we already do something similar for datasources). If this is the answer, what names should we choose? I tried changing <jndi-name>user/UserManager</jndi-name> to <jndi-name>ejb/mycompany/myapp/user/UserManager</jndi-name>, but that didn't work - I got errors that mycompany wasn't bound.

      Any help would be appreciated.