5 Replies Latest reply on Mar 9, 2014 4:06 PM by wdfink

    Configure different EJB application to use different ejb versions - jboss AS 6

    imeshd

      Hi,

       

      My initial issue is I want to define custom JNDI name. I tried with @ejb(name="myBean", beanInterface=myInterface.class) but did not work for me.So when I read about this I found in some forum as well in the this forum some ppl discuss about ejb 3.1 does not support custom JNDI.

       

      If this is true..  I have 3 questions.

       

      1. How do I set my application to compile and run any specific version of EJB ? Note that I don't have ejb-jar.xml. So how to do this in annotation level or any other way(may be maven at compile time)

      2. How do I check which version of EJB is applied by jboss to run my application. (assume if 1st question has a way to setup the run time ejb version) .

      3. Can I define different ejb version to run on different application in the same Jboss AS ? Because I have ejb 3.1 running application which does not need custom JNDI.

       

      All above is based on the AS 6.1.0.

        • 1. Re: Configure different EJB application to use different ejb versions - jboss AS 6
          wdfink

          If you deploy an ejb application to a server it dosn't matter which ejb version it is. The only requirement is that the server support the version.

          So an EJB3.0 application will be deployed the same way as a EJB3.1 app.

           

          If you really use JBossAS6.x you might use mappedName annotation to deploy with a different name.

          With JBossAS7 (EAP6.1 is based on this one) this is not longer supported and the attribute might be ignored.

          But in that case the JND name is <app/ear name>/<module name>/<bean name>/<interface> and you might change the ear name to have a different name.

          • 2. Re: Configure different EJB application to use different ejb versions - jboss AS 6
            imeshd

            Hi Wolf-Dieter,

             

            Thanks for the reply. I actually tried the EJB3.0 annotation but did not work for me. This is why I thought that the JBoss some how use EJB3.1 spec. Because in my JBoss I have some other application which use EJB3.1.   When I deploy my application the JNDI name was <ear name>/<bean name>/<interface type (local)    this is how it worked for me. It is not even taking the module name. weird..  I am actually lost between EJB3.0 , EJB3.1 and JBOSS AS6.X  JNDI conventions. The examples in the web to overwrite the JNDI name @EJB(mappedName="my_own_jndi_name")  did not work in my ear.

             

            How can I understand the correct behaviour within EJB3.0, 3.1 and Jboss AS6.x  ?

            • 3. Re: Configure different EJB application to use different ejb versions - jboss AS 6
              wdfink

              You might use the @Stateless(mappedName=XXX) to rename the JNDI entry. You might need to experiment a bit.

               

              Do you really use JBossAS6 and not EAP6 or AS7?

              JBossAS6 is outdated and I'm not sure how the behaviour is. I recommend to use AS7 or WildFly8.

              • 4. Re: Configure different EJB application to use different ejb versions - jboss AS 6
                imeshd

                Hi Wolf-Dieter,

                 

                I tried all the ways but did not work. That's why I suspect is there a way to say specifically use the specific EJB version. So two things below pls verify

                 

                1.   Jboss AS7 use EJB3.1 spec and cannot change the JNDI name or custom JNDI. Is it ?

                 

                2.   Older Jboss version like AS6.x even it use EJB3.1 spec still can change the JNDI name.

                • 5. Re: Configure different EJB application to use different ejb versions - jboss AS 6
                  wdfink

                  1) Yes, with AS7 and EJB3.1 th JNDI name handling has changed and was unified.

                  2) With former AS and EJB versions this was different.

                   

                  You might use the application.xml descriptor to use a different name for deployments