3 Replies Latest reply on Nov 20, 2007 4:50 AM by jaikiran pai

    ejb3 binding

    Filippo De Luca Newbie

      Dear jboss users
      I have one question about jndi binding. I've a ear archive, application.ear, containinig my ejb jar file and persistence unit jar file. When i deploy it, my ejb are bind to "application/EjbName".

      but my ear have a version after the name, so every time the version change, i had to update the client code. It is possible, remove the ear filename from the jndi, or change it?

      any help are appreciate.

        • 1. Re: ejb3 binding
          jaikiran pai Master

           

          When i deploy it, my ejb are bind to "application/EjbName".


          That's the default.

          It is possible, remove the ear filename from the jndi, or change it?


          Yes, its possible. You can specify any jndi name of your choice for the EJBs. You can either use annotations (for EJB3) or jboss.xml to do this. Here's an example using annotations:

          @Stateless
          @Remote ({UserManager.class})
          @RemoteBinding (jndiBinding = "RemoteUserManagerBean")
          public class UserManagerBean implements UserManager {
          ....
          }


          See the use of @RemoteBinding, above. With this annotation the UserManagerBean is now bound to "RemoteUserManagerBean" jndi name(you can specify any unique jndi name of your choice).

          The other way to do this is adding an entry in the jboss.xml (as follows):

          <session>
           <ejb-name>UserManagerBean</ejb-name>
           <jndi-name>RemoteUserManagerBean</jndi-name>
          
           </session>

          For more details refer to the jboss.xml dtd.


          • 2. Re: ejb3 binding
            Filippo De Luca Newbie

            Tank you, so i've looked the jboss.xml dtd, the item <jndi-name /> is equivalent to RemoteBinding annotation, and <local-jndi-name /> to LocalBinding, it's right?

            Tanks a lot

            • 3. Re: ejb3 binding
              jaikiran pai Master

              Yes, that's correct.