6 Replies Latest reply on Aug 4, 2010 7:17 AM by william.drai

    EJB 3.1 war packaging in JBoss 6 M3 and M4

    william.drai

      Hi all,

       

      I've tried to build a simple war containing annotated EJB classes in WEB-INF/classes but the EJBs are not deployed and they don't appear in the global JNDI view.

       

      The war is very simple, it contains a very basic stateless EJB with interface and a JPA entity :

       

      test.war

         index.html

         test.swf

         WEB-INF

             web.xml

             classes

                  test.service.TestService

                  test.service.TestServiceBean

                  test.entity.TestEntity

                  META-INF

                       persistence.xml

             lib

                  util.jar

       

      Nothing very sophisticated, but it does not work in M3 and M4.

       

      The status of this EJB 3.1 war packaging feature in JBoss 6 milestones is not very clear. It has been announced in some blog post but the JIRA is still open. Is this supposed to work out-of-the-box or is there something to configure ?

       

      Thanks.

      William

        • 1. Re: EJB 3.1 war packaging in JBoss 6 M3 and M4
          jaikiran

          William Draï wrote:

           


           

          The status of this EJB 3.1 war packaging feature in JBoss 6 milestones is not very clear. It has been announced in some blog post but the JIRA is still open. Is this supposed to work out-of-the-box or is there something to configure ?

           


          It's supported since JBoss AS 6.0.0.M2 http://community.jboss.org/wiki/EJB31inAS600M2

           

          William Draï wrote:

           

          Hi all,

           

          I've tried to build a simple war containing annotated EJB classes in WEB-INF/classes but the EJBs are not deployed and they don't appear in the global JNDI view.

           

          Global JNDI view isn't yet (completely) supported in 6.0. The beans however will still be bound to JNDI, but won't be following the EJB3.1 global jndi name syntax.

          1 of 1 people found this helpful
          • 2. Re: EJB 3.1 war packaging in JBoss 6 M3 and M4
            william.drai

            Thanks for the quick response.

             

            The EJB does not appear at all in the JNDI view with any name, not even the JBoss naming convention module/beanName/local.

            It seems that EJBs deployed from wars are not available from JNDI at all. I guess they can only be used with @EJB.

            • 3. Re: EJB 3.1 war packaging in JBoss 6 M3 and M4
              jaikiran

              William Draï wrote:

               


              It seems that EJBs deployed from wars are not available from JNDI at all. I guess they can only be used with @EJB.

              For @EJB to work they have to be available in JNDI

               

              I suspect it's a problem with your web.xml. What does it look like? Does it use the 3.0 version xsd?

              • 4. Re: EJB 3.1 war packaging in JBoss 6 M3 and M4
                william.drai

                Right, I copy/pasted the wrong web.xml. It works fine now with version="3.0".

                 

                As you said, the standard JEE6 naming convention is not supported.

                In this case of war packaging, the global name is "ejbname/local" (was earname/ejbname/local in the case of ear packaging).

                 

                I wonder what would happen if the same EJB is deployed in different wars ?

                 

                Thanks.

                • 5. Re: EJB 3.1 war packaging in JBoss 6 M3 and M4
                  jaikiran

                  William Draï wrote:

                   

                  I wonder what would happen if the same EJB is deployed in different wars ?

                   

                  Naming conflicts Unless you name that EJB differently.

                  • 6. Re: EJB 3.1 war packaging in JBoss 6 M3 and M4
                    william.drai

                    Of course

                     

                    This default naming is not a very good idea imho. It would be better to qualify this name with the war name (as in the standard naming convention), but I guess if it was so easy you would probably have also implemented the standard naming .

                     

                    This is far from critical for now, hopefully this will be fixed in the RC.