4 Replies Latest reply on Jan 21, 2010 7:08 AM by pravumishra

    Why EJB 2.0 TO EJB 3.0 migration?

      Hi There,

       

      The latest JBoss supports both EJB 2.0 and EJB 3.0. Guess existance of both the type of beans in a single EAR problem does not create any problem and it it works.

       

      I have many modules those are developed by using EJB 2.0 and many new modules developed by using ejb 3.0. Instead of modifying( migrating) the EJB 2.0 code to ejb 3.0 I wanted to integrate all the modules in a single EAR file.

       

      After placing all the modules into single EAR file, I foound the Screens those uses EJB 3.0 works fine and for EJB 2.0 it says  javax.naming.NameNotFoundException: Bean not bound

       

      From the defined 2.0 JNDI name it is not able to get the object. Is the declaration of JNDI names and bean mapping for 2.0 is useless in case we use both type of beans(2.0 and 3.0) in a single EAR?

       

      It looks like there is some declaration missing in any of the configuration file.


      Can any body let me know how to make it work.


      Thanks and Regards,
      Pravu Mishra.

        • 1. Re: Why EJB 2.0 TO EJB 3.0 migration?
          jaikiran

          pravumishra wrote:

           

          After placing all the modules into single EAR file, I foound the Screens those uses EJB 3.0 works fine and for EJB 2.0 it says  javax.naming.NameNotFoundException: Bean not bound

           


          Please provide the exact details including the exception stacktrace and even the configuration files. Please also show us which dtd/xsd reference you have in those ejb-jar.xml and jboss.xml (if any) for the EJB2.x beans. Are these beans packaged in a separate .jar in the .ear?

           

          And which exact version of JBoss AS and Java do you use?

          • 2. Re: Why EJB 2.0 TO EJB 3.0 migration?

            Hi Jaikiran,

             

            Please find attached a zip file that contains configuration files for EJB 2.x (ejb-jar.xml, jboss.xml,jbosscmp-jdbc.xml) and EJB 3.0(persistence.xml).

             

            I am using java 1.6 and jboss 4.2.3 and my beans are not packed into separate jars, instead those are packed into single jar file inside the EAR.  I am using Eclipse 3.3 and used the Dinamic web project of Eclipse for checking the fisibility of using both the type of ejbs in a single EAR.

             

            Hope I have provided all the required information.

             

            Thanks and Regards,

            Pravu Mishra.

            • 3. Re: Why EJB 2.0 TO EJB 3.0 migration?
              jaikiran

              pravumishra wrote:

               

              my beans are not packed into separate jars, instead those are packed into single jar file inside the EAR.


              You cannot have both EJB2.x and EJB3.x beans in a single jar.

               

              pravumishra wrote:

               

              Hi Jaikiran,

               

              Please find attached a zip file

              For files like this, it's better to post the contents here instead of attaching them as an attachment. Posting the contents allows for a quick glance of the files instead of having to download the attachment (which for the most common cases is just a waste of time).

              • 4. Re: Why EJB 2.0 TO EJB 3.0 migration?

                Hi Jaikiran,

                 

                Thanks a lot for providing information. It works.

                 

                I created another EJB 2.0 project  in Eclipse and placed the EJB 2.0 code and deployment descriptors inside for separating the EJB 3.0 and EJB 2.0 code and placing into two jar files.

                 

                It means there are two jar files inside the current EAR, one contains EJB 2.0 and another contains EJB 3.0 classes and descriptors.

                 

                It works after this change.

                 

                 

                Thanks and Regards,

                Pravu Mishra.