5 Replies Latest reply on Mar 11, 2007 4:59 AM by Jeroen Wenting

    EJB 2.1 and 3.0 in one web-app

    Michal Glowacki Novice


      I've just decided to rewrite beans from my web-app from 2.1 to 3.0. But as I will not do this at once I want to ask if is it possible to have some ejb 2.1 and some 3.0?


        • 1. Re: EJB 2.1 and 3.0 in one web-app
          Eric Yip Newbie

          Hi mglowacki,

          Did you find out the answer? If yes, can you let me know? Is there anything special I need to do?


          • 2. Re: EJB 2.1 and 3.0 in one web-app
            hanasaki jiji Newbie

            When installing jboss 4.x, the installer says the container is either j2ee 1.4 (ie: ejb2) OR j2ee5 (ie: ejb3) - They appear to be mutually exclusive.

            You could leave the ejb2 and ejb3 stuff in their own appservers and call them remotely...

            • 3. Re: EJB 2.1 and 3.0 in one web-app
              Michal Glowacki Novice

              @elikyip: no, i didn't find an answer, to be honest, didn't even try to find :) I still have some time until decision, so I wanted to wait for replies in this thread.

              @hanasakijiji: I haven't used installer, but if it's like this, it shouldn't be a problem. I can use 2 servers during dev, because I want use just 2.1 or 3.0 on production server. Thanks for response.

              • 4. Re: EJB 2.1 and 3.0 in one web-app
                arisa Newbie

                I too am researching mixing EJB 2.1 and 3.0 Beans in the same .jar file. I have verified that you can mix EJB2.1 SLSB and EJB3 SLSB in the same .jar file. Unit tests verified that they work perfectly together.

                HOWEVER, currently I am not able to mix EJB2.1 entities with EJB3 entities.

                * If persistence.xml is placed inside the .jar file, then the EJB3 deployer kicks in and only EJB3 entity beans are deployed.

                * If I remove the persistence.xml file, then the normal deployment takes place and only my EJB2.1 entity beans are deployed.

                It would be really really great if someone could shed light on this issue. I'm sure there are many of us who want to upgrade to EJB3 but can only do so partially (and is one of the objectives of EJB3 to allow interoperability if I'm not mistaken). It would be a problem if EJB2.1 and EJB3 entities had to be packaged in different .jar files as I would not be able to implement CMR between those entities.

                Thanks very much in advance.

                ps. sorry for the same posting to two different forum messages, as they are similar.

                • 5. Re: EJB 2.1 and 3.0 in one web-app
                  Jeroen Wenting Newbie

                  the container can take EJB3 and EJB2 at the same time, but they can NOT be part of the same deployment archive (EJB Jar, maybe even EAR).
                  That's per the spec btw.