5 Replies Latest reply on Feb 28, 2012 4:05 PM by chaatna

    Migration of EJB 2.1 from WebSphere to JBoss 5.1

    chaatna

      We have a application with EJB 2.1 running on WebSphere. Now we are migrating from WebSphere to Jboss 5.1.

      Could you anybody help how to migrate my EJB 2.1 stuff from Websphere to JBoss?

      I have ejb-jar.xml and I am not sure where to keep it. Do I need to have a separate project for EJB code? Now I have mixed EJB code with normal java project code.

      Is JBoss.xml is mandatory for EJB 2.1 migration from WAS to JBoss 5.1?

      Can I use the ejb-jar.xml as it is? If yes, could I know where can I keep those files?

      I have configuration in web.xml as follows:

       

      <ejb-ref id="EjbRef_1161372912989">

        <description>

        </description>

        <ejb-ref-name>slatimer</ejb-ref-name>

        <ejb-ref-type>Session</ejb-ref-type>

        <home>com.test.ejb.timer.SLATimerHome</home>

        <remote>com.test.ejb.timer.SLATimer</remote>

        <ejb-link>test-ejb.jar#SLATimer</ejb-link>

      </ejb-ref>

      <ejb-ref id="EjbRef_1208534937303">

        <description>

        fdfds</description>

        <ejb-ref-name>tolreminder</ejb-ref-name>

        <ejb-ref-type>Session</ejb-ref-type>

        <home>com.test.ejb.timer.ReminderEmailTimerHome</home>

        <remote>com.test.ejb.timer.ReminderEmailTimer</remote>

        <ejb-link>test-ejb.jar#ReminderEmailTimer</ejb-link>

      </ejb-ref>

       

       

      Please help in this issue with detailed procedure.

      Thanks, Chaatna

        • 1. Re: Migration of EJB 2.1 from WebSphere to JBoss 5.1
          wdfink

          The behaviour will be different if you change the application server, expecialy if you use EJB2 and CMP

           

          The ejb-jar.xml should be the same. You can add the jboss.xml to you application and deploy it on both because the container specific xml will be ignored.

          The Java code is usable for both.

          • 2. Re: Migration of EJB 2.1 from WebSphere to JBoss 5.1
            chaatna

            Hi wolf-dieter Fink,

             

            Thanks for your reply.

             

            So I can use ejb-jar.xml as it is from Websphere.

             

            Could you let me know whether "jboss.xml" and "jbosscmp-jdbc.xml"is mandatory? if yes, which contents have to be in those files and how it differs. I have two files named "ibm-ejb-jar-bnd.xmi" and "ibm-ejb-jar-ext.xml". I think "jboss.xml" and "jbosscmp-jdbc.xmk" replaces those two files.

             

            Could you clarify me in detail?

             

            Thanks in advance.

             

            Regards,

            Chaatna

            • 3. Re: Migration of EJB 2.1 from WebSphere to JBoss 5.1
              wdfink

              With EJB2 you need such files here a short example. See JBoss tutorials and dtd/schema.

               

              ====  jboss.xml ====

              <jboss>

                <enterprise-beans>

                  <entity>

                    <ejb-name>MyEntity</ejb-name>

                    <local-jndi-name>ejb21/MyEntity</local-jndi-name>

                    <configuration-name>Standard CMP EntityBean</configuration-name> <!-- optional -->

                  </entity>

                  <session>

                    <ejb-name>MySession</ejb-name><jndi-name>ejb21/MySession</jndi-name>

                    <clustered>true</clustered>

                    <method-attributes></method-attributes>

                  </session>

                </enterprise-beans>

              </jboss>

               

              ===== jbosscmp-jdbc.xml  (only if you have entities in your applcation) ======

              <jbosscmp-jdbc>

                <defaults>

                  <create-table>true</create-table>

                  <alter-table>true</alter-table>

                  <remove-table>false</remove-table>

                </defaults>

                <enterprise-beans>

                  <entity>

                    <ejb-name>MyEntity</ejb-name>

                    <table-name>Entity_TBL</table-name>

                    <cmp-field>

                      <field-name>Id</field-name>

                      <not-null/>

                    </cmp-field>

                    <cmp-field>

                      <field-name>text</field-name>

                      <not-null/>

                    </cmp-field>

                  </entity>

                  <relationships>

                  </relationships>

                  <entity-commands>

                  </entity-commands>

              </jbosscmp-jdbc>

              • 4. Re: Migration of EJB 2.1 from WebSphere to JBoss 5.1
                chaatna

                Hi wolf-dieter,

                 

                I have only MDBs and JMS. So no need of "jbosscmp-jdbc.xml".

                 

                I have configuration in "ejb-jar.xml" as  follows:

                <

                 

                <message-driven id="ProcessInboundMDB">

                 

                <ejb-name>ProcessInboundMDB</ejb-name>

                 

                <ejb-class>com.test.mdb.ProcessInboundMDBBean</ejb-class>

                 

                <messaging-type>javax.jms.MessageListener</messaging-type>

                 

                <transaction-type>Container</transaction-type>

                 

                <message-destination-type>javax.jms.Queue</message-destination-type>

                 

                <activation-config>

                 

                <activation-config-property>

                 

                <activation-config-property-name>destinationType</activation-config-property-name>

                 

                <activation-config-property-value>javax.jms.Queue</activation-config-property-value>

                 

                </activation-config-property>

                 

                <activation-config-property>

                 

                <activation-config-property-name>messageSelector</activation-config-property-name>

                 

                <activation-config-property-value>JMSType = 'Process_Inbound'</activation-config-property-value>

                 

                </activation-config-property>

                 

                </activation-config>

                 

                <resource-ref id="ResourceRef_1171566402351">

                 

                <description>

                 

                </description>

                 

                <res-ref-name>jdbc/TestDB</res-ref-name>

                 

                <res-type>javax.sql.DataSource</res-type>

                 

                <res-auth>Container</res-auth>

                 

                <res-sharing-scope>Shareable</res-sharing-scope>

                 

                </resource-ref>

                 

                <resource-ref id="ResourceRef_1171570701024">

                 

                <description>

                 

                </description>

                 

                <res-ref-name>jms/TestQueue</res-ref-name>

                 

                <res-type>javax.jms.Queue</res-type>

                 

                <res-auth>Container</res-auth>

                 

                <res-sharing-scope>Shareable</res-sharing-scope>

                 

                </resource-ref>

                 

                <resource-ref id="ResourceRef_1171570902013">

                 

                <description>

                 

                </description>

                 

                <res-ref-name>jms/TestTopic</res-ref-name>

                 

                <res-type>javax.jms.Topic</res-type>

                 

                <res-auth>Container</res-auth>

                 

                <res-sharing-scope>Shareable</res-sharing-scope>

                 

                </resource-ref>

                 

                <resource-ref id="ResourceRef_1171571112394">

                 

                <description>

                 

                </description>

                 

                <res-ref-name>jms/TestConnectionFactory</res-ref-name>

                 

                <res-type>javax.jms.ConnectionFactory</res-type>

                 

                <res-auth>Container</res-auth>

                 

                <res-sharing-scope>Shareable</res-sharing-scope>

                 

                </resource-ref>

                 

                </message-driven>

                 

                 

                I have configured the corresponding one in "jboss.xml" as follows:

                <?

                 

                <xml version="1.0" encoding="UTF-8"?>

                <!

                 

                DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_5_0.dtd">

                <

                 

                <jboss>

                 

                <enterprise-beans>

                 

                 

                <message-driven>

                 

                <ejb-name>ProcessInboundMDBBean</ejb-name>

                 

                <destination-jndi-name>jms/TestQueue</destination-jndi-name>

                 

                </message-driven>

                 

                </enterprise-beans>

                </

                </jboss>

                 

                 

                Is it correct or Do I need to add any more configuration related to "ejb-jar.xml" configuration?

                 

                Please help me.

                 

                Thanks,

                Chaatna

                • 5. Re: Migration of EJB 2.1 from WebSphere to JBoss 5.1
                  chaatna

                  Hi,

                   

                  I have one more issue. I have a code dependency as follows:

                   

                  MPG_TR_BizApp_CodeFlow_28-Feb-2012.jpg

                  Our EJB code depends on businessCode. We are preparing WAR file with the business code. Again we have some EJB listeners in webProject which inturn depends on EJB project. Finally we are preparing ear with the combination of WebProject and EJbProject.

                  Now we are getting the following exception:

                   

                   

                   

                   

                   

                  11:44:36,363 ERROR [AbstractKernelController] Error installing to Parse: name=vfszip:/C:/JBoss51/jboss-eap-5.1/jboss-as/server/DEV_server0/deploy/test-app-1.0-SNAPSHOT.ear/ state=PreParse mode=Manual requiredState=Parse

                   

                  org.jboss.deployers.spi.DeploymentException

                   

                   

                  : Error creating managed object for vfszip:/C:/JBoss51/jboss-eap-5.1/jboss-as/server/DEV_server0/deploy/test-app-1.0-SNAPSHOT.ear/lib/common.jar/spring-hibernate.xml

                  at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(

                  DeploymentException.java:49

                  )

                  at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(

                  AbstractParsingDeployerWithOutput.java:362

                  )

                  at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(

                  AbstractParsingDeployerWithOutput.java:322

                  )

                  at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(

                  AbstractParsingDeployerWithOutput.java:294

                  )

                  at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(

                  AbstractParsingDeployerWithOutput.java:234

                  )

                  at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(

                  DeployerWrapper.java:179

                  )

                  at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(

                  DeployersImpl.java:1454

                  )

                  at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(

                  DeployersImpl.java:1172

                  )

                  at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(

                  DeployersImpl.java:1225

                  )

                  at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(

                  DeployersImpl.java:1225

                  )

                  at org.jboss.deployers.plugins.deployers.DeployersImpl.install(

                  DeployersImpl.java:1113

                  )

                  at org.jboss.dependency.plugins.AbstractControllerContext.install(

                  AbstractControllerContext.java:348

                  )

                  at org.jboss.dependency.plugins.AbstractController.install(

                  AbstractController.java:1652

                  )

                  at org.jboss.dependency.plugins.AbstractController.incrementState(

                  AbstractController.java:938

                  )

                  at org.jboss.dependency.plugins.AbstractController.resolveContexts(

                  AbstractController.java:1082

                  )

                  at org.jboss.dependency.plugins.AbstractController.resolveContexts(

                  AbstractController.java:988

                  )

                  at org.jboss.dependency.plugins.AbstractController.change(

                  AbstractController.java:826

                  )

                  at org.jboss.dependency.plugins.AbstractController.change(

                  AbstractController.java:556

                  )

                  at org.jboss.deployers.plugins.deployers.DeployersImpl.process(

                  DeployersImpl.java:789

                  )

                  at org.jboss.deployers.plugins.main.MainDeployerImpl.process(

                  MainDeployerImpl.java:699

                  )

                  at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(

                  MainDeployerAdapter.java:117

                  )

                  at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(

                  ProfileDeployAction.java:70

                  )

                  at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(

                  AbstractProfileAction.java:53

                  )

                  at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(

                  AbstractProfileService.java:403

                  )

                  at org.jboss.dependency.plugins.AbstractControllerContext.install(

                  AbstractControllerContext.java:348

                  )

                  at org.jboss.dependency.plugins.AbstractController.install(

                  AbstractController.java:1652

                  )

                  at org.jboss.dependency.plugins.AbstractController.incrementState(

                  AbstractController.java:938

                  )

                  at org.jboss.dependency.plugins.AbstractController.resolveContexts(

                  AbstractController.java:1082

                  )

                  at org.jboss.dependency.plugins.AbstractController.resolveContexts(

                  AbstractController.java:988

                  )

                  at org.jboss.dependency.plugins.AbstractController.install(

                  AbstractController.java:778

                  )

                  at org.jboss.dependency.plugins.AbstractController.install(

                  AbstractController.java:543

                  )

                  at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(

                  AbstractProfileService.java:308

                  )

                  at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(

                  ProfileServiceBootstrap.java:256

                  )

                  at org.jboss.bootstrap.AbstractServerImpl.start(

                  AbstractServerImpl.java:461

                  )

                  at org.jboss.Main.boot(

                  Main.java:221

                  )

                  at org.jboss.Main$1.run(

                  Main.java:556

                  )

                  at java.lang.Thread.run(

                  Thread.java:619

                  )

                  Caused by:

                  java.lang.ClassCastException

                  at java.lang.Class.cast(

                  Class.java:2990

                  )

                  at org.jboss.xb.util.JBossXBHelper.parse(

                  JBossXBHelper.java:194

                  )

                  at org.jboss.xb.util.JBossXBHelper.parse(

                  JBossXBHelper.java:166

                  )

                  at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(

                  SchemaResolverDeployer.java:137

                  )

                  at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(

                  SchemaResolverDeployer.java:121

                  )

                  at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parseAndInit(

                  AbstractVFSParsingDeployer.java:304

                  )

                  at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse(

                  AbstractVFSParsingDeployer.java:269

                  )

                  at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(

                  AbstractParsingDeployerWithOutput.java:355

                  )

                  ... 35 more

                   

                   

                  Please suggest me two things 1) whether jboss.xml configuration is right   2) whether project code dependency is right or wrong. if wrong please suggest me.

                   

                  Thanks inadvance.

                   

                  Regards,

                  Chaatna