4 Replies Latest reply on Dec 5, 2006 2:18 PM by knaas

    jndi name of ejb in ear

      EJBs deployed from an EAR are put under the EAR's jndi namespace. For instance if the ear file is "my-ear.ear", and there is a Local Session Bean with the name of "MySessionBean", it will be bound to "my-ear/MySessionBean". In order for Seam to lookup this EJB, it requires a change to the components.xml so that instead of using "#{ejbName}/local" it uses "my-ear/#{ejbName}/local". While this works great, the ear name is now hardcoded in the ejb jar module inside of the ear. This isn't such a big problem until someone renames the ear file. At this point,the components.xml has to be updated since Seam can no longer find "my-ear/MySessionBean/local". This is a big problem, especially when trying to run multiple versions of the same application on a single server.

      One possibility to fix the problem is to override the jndi name using either the @LocalBinding or @JndiName annotations. However, the jndi bindings of different EARS can collide since they both name is now hardcoded in the Java class.

      Would it be possible for the Seam jndiPattern to automatically look in the EAR's jndi namespace?