14 Replies Latest reply on Dec 31, 2012 2:22 AM by Nicklas Karlsson

    EJB 2.0 on JBoss AS 7.1CR1

    Levente Sántha Newbie

      I'm trying to port an old Java EE application to JBoss AS 7.1 and I get the following problem.

      I have two EJB jars: idgenerator and locking-server. A CMP entity bean in locking-server refers to a session bean in idgenerator. When I try to deploy locking-server I get the following error:

       

       18:42:16,220 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."locking-server.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."locking-server.jar".INSTALL: Failed to process phase INSTALL of deployment "locking-server.jar"
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as- server-7.1.0.CR1b.jar:7.1.0.CR1b]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.7.0_01]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.7.0_01]
      at java.lang.Thread.run(Thread.java:722) [:1.7.0_01]
      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011058: Failed to install component Locking
      at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:95)
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.1.0.CR1b.jar:7.1.0.CR1b]
      ... 5 more
      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014544: No EJB found with interface of type 'norics.standard.server.IDGeneratorSessionHome' for binding java:comp/env/ejb/IDGeneratorSession
      at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:85)
      at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.processBindings(ComponentInstallProcessor.java:240)
      at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deployComponent(ComponentInstallProcessor.java:184)
      at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:93)
      ... 6 more

       

       

      Earlier in the log I have:

      JNDI bindings for session bean named IDGeneratorSession in deployment unit deployment "idgenerator.jar" are as follows:
      ...
      java:global/idgenerator/IDGeneratorSession!norics.standard.server.IDGeneratorSessionHome
      java:app/idgenerator/IDGeneratorSession!norics.standard.server.IDGeneratorSessionHome
      java:module/IDGeneratorSession!norics.standard.server.IDGeneratorSessionHome
      

       

      If I comment out the ejb-refrence in locking-server ejb-jar.xml the deployment succeeds. If I change the source code of locking-server to lookup the name java:global/idgenerator/IDGeneratorSession!norics.standard.server.IDGeneratorSessionHome then the code does work.

       

      Is there a solution to avoid these extra steps like removing the excplicit remote EJB refernces from the EJB 2.0 deployment descriptors and changing the code to lookup the non-local EJBs under the new global namespace?

       

      Is it possible to make the idgenerator session bean available under the namespace used by EJB 2.0: java:comp/env/ejb/IDGeneratorSession ?

      Otherwise the porting would involve too many changes in the code.

       

      Thank you, Levente

        • 1. Re: EJB 2.0 on JBoss AS 7.1CR1
          Stephen Coy Master

          You're looking up an ENC name:

          java:comp/env/ejb/IDGeneratorSession

          You probably need to update the mappings in your jboss.xml file:

          <session>
               <ejb-name>Locking</ejb-name>
               ...
               <ejb-ref>
                    <ejb-ref-name>ejb/IDGeneratorSession</ejb-ref-name>
                    <jndi-name>java:app/idgenerator/IDGeneratorSession!norics.standard.server.IDGeneratorSessionHome</jndi-name>
               </ejb-ref>
               ...
          </session>
          • 3. Re: EJB 2.0 on JBoss AS 7.1CR1
            Levente Sántha Newbie

            Indeed jboss.xml is completely ignored but jboss-ejb3.xml doesn't seem to help because jndi-name is not supported for session beans (see: https://issues.jboss.org/browse/AS7-3015)

            For local-ejb-ref the lookup of entity bean ENC names works just like in JBoss 4.

            For session beans the ENC name lookup failure appears during deployment independently of how is the lookup performed in the code.

            At the moment I can see no solution other than using the java:app and java:global contexts for looking up remote session bean references which involves significant changes in the source code when migrating EJB2 modules from JBoss 4 to JBoss 7.1.

            • 4. Re: EJB 2.0 on JBoss AS 7.1CR1
              Stephen Coy Master

              I believe that you have misinterpreted AS7-3015. This is discussing the binding of JNDI names to EJBs. Your problem appears to be related to ejb references.

              <session>
                   <ejb-name>Locking</ejb-name>
                   <jndi-name>not supported here as per AS7-3015</jndi-name>
                   ...
                   <ejb-ref>
                        <ejb-ref-name>ejb/IDGeneratorSession</ejb-ref-name>
                        <jndi-name>java:app/idgenerator/IDGeneratorSession!norics.standard.server.IDGeneratorSessionHome</jndi-name>
                   </ejb-ref>
                   ...
              </session>

               

              The link provided by jaikiran is an actual test case for what you're trying to do.

              • 5. Re: EJB 2.0 on JBoss AS 7.1CR1
                Levente Sántha Newbie

                With a jboss-ejb3.xml added to locking-server I get this error:

                 
                14:19:13,147 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."locking-server.jar".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."locking-server.jar".PARSE: Failed to process phase PARSE of deployment "locking-server.jar"
                        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as-server-7.1.0.CR1b.jar:7.1.0.CR1b]
                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.7.0_01]
                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.7.0_01]
                        at java.lang.Thread.run(Thread.java:722) [:1.7.0_01]
                Caused by: java.lang.ClassCastException: org.jboss.metadata.ejb.spec.EntityBeanMetaData cannot be cast to org.jboss.metadata.ejb.jboss.ejb3.JBossGenericBeanMetaData
                        at org.jboss.metadata.ejb.spec.EntityBeanMetaData.merge(EntityBeanMetaData.java:121)
                        at org.jboss.metadata.ejb.spec.EntityBeanMetaData.createMerged(EntityBeanMetaData.java:112)
                        at org.jboss.metadata.ejb.spec.EntityBeanMetaData.createMerged(EntityBeanMetaData.java:32)
                        at org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData.merge(EnterpriseBeansMetaData.java:73)
                        at org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData.createMerged(EnterpriseBeansMetaData.java:52)
                        at org.jboss.metadata.ejb.spec.EjbJarMetaData.merge(EjbJarMetaData.java:175)
                        at org.jboss.metadata.ejb.spec.EjbJarMetaData.createMerged(EjbJarMetaData.java:668)
                        at org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor.deploy(EjbJarParsingDeploymentUnitProcessor.java:124)
                        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.1.0.CR1b.jar:7.1.0.CR1b]
                        ... 5 more
                
                • 6. Re: EJB 2.0 on JBoss AS 7.1CR1
                  Stephen Coy Master

                  That smells like a bug...

                  • 7. Re: EJB 2.0 on JBoss AS 7.1CR1
                    jaikiran pai Master

                    Can you please post the jboss-ejb3.xml (and ejb-jar.xml) which triggered that ClassCastException?

                    • 8. Re: EJB 2.0 on JBoss AS 7.1CR1
                      Levente Sántha Newbie

                      This is the jboss-ejb3.xml:

                       

                      <?xml version="1.0"?>
                      <jboss:ejb-jar  xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
                                      xmlns="http://java.sun.com/xml/ns/javaee"
                                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                      xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd
                                           http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
                                      version="3.1"
                                      impl-version="2.0">
                            <enterprise-beans>     
                                 <entity>
                                      <ejb-name>Locking</ejb-name>
                                      <ejb-ref>
                                           <ejb-ref-name>ejb/IDGeneratorSession</ejb-ref-name>
                                           <jndi-name>java:app/idgenerator/IDGeneratorSession!norics.standard.server.IDGeneratorSessionHome</jndi-name>
                                           </ejb-ref>
                                 </entity>
                            </enterprise-beans>
                      </jboss:ejb-jar>

                      • 9. Re: EJB 2.0 on JBoss AS 7.1CR1
                        Thomas Fossum Newbie

                        We have similiar experiences, it seems to us that the ClassCastException is thrown when both jboss-ejb3.xml and jbosscmp-jdbc.xml is used?

                        If we use only jboss-ejb3.xml, session beans deploy is successful, and with only jbosscmp-jdbc.xml, entity beans are being deployed.

                        • 10. Re: EJB 2.0 on JBoss AS 7.1CR1
                          JN JNC Newbie

                          I got same kind of exception when trying to deploy a MDB with a jboss-ejb3.xml configuration

                           

                           

                          Caused by: java.lang.ClassCastException: org.jboss.metadata.ejb.spec.MessageDrivenBean31MetaData cannot be cast to org.jboss.metadata.ejb.jboss.ejb3.JBossGenericBeanMetaData
                          at org.jboss.metadata.ejb.spec.MessageDrivenBeanMetaData.merge(MessageDrivenBeanMetaData.java:353)
                          at org.jboss.metadata.ejb.spec.MessageDrivenBeanMetaData.createMerged(MessageDrivenBeanMetaData.java:85)
                          at org.jboss.metadata.ejb.spec.MessageDrivenBeanMetaData.createMerged(MessageDrivenBeanMetaData.java:36)
                          at org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData.merge(EnterpriseBeansMetaData.java:73)
                          at org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData.createMerged(EnterpriseBeansMetaData.java:52)
                          at org.jboss.metadata.ejb.spec.EjbJarMetaData.merge(EjbJarMetaData.java:175)
                          at org.jboss.metadata.ejb.spec.EjbJarMetaData.createMerged(EjbJarMetaData.java:668)
                          at org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor.deploy(EjbJarParsingDeploymentUnitProcessor.java:124)
                          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.1.0.CR1b.jar:7.1.0.CR1b]
                          ... 5 more

                           

                           

                           

                          <jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
                          xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                          xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd
                          http://java.sun.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-spec-2_0.xsd"
                          version="3.1" impl-version="2.0">
                          <enterprise-beans>
                            <message-driven>
                             <ejb-name>TestMDB</ejb-name>
                             <ejb-ref>
                              <ejb-ref-name>ejb/TestProcessingBeanRemote</ejb-ref-name>
                              <jndi-name>TEST_EAR/TESTProcessingBean/remote</jndi-name>
                             </ejb-ref>
                             <ejb-ref>
                              <ejb-ref-name>ejb/TestProcessingBeanLocal</ejb-ref-name>
                              <jndi-name>TEST_EAR/TESTProcessingBean/local</jndi-name>
                             </ejb-ref>  
                            </message-driven>
                          </enterprise-beans>
                          </jboss:ejb-jar>

                           

                          • 11. Re: EJB 2.0 on JBoss AS 7.1CR1
                            Ondra Chaloupka Expert

                            I have the same problem. I have created a jira for it: https://issues.jboss.org/browse/AS7-3380

                            • 12. Re: EJB 2.0 on JBoss AS 7.1CR1
                              Levente Sántha Newbie

                              I have noticed that the ClassCastException is fixed in JBoss AS 7.1 Final. Thank you.

                              • 13. Re: EJB 2.0 on JBoss AS 7.1CR1
                                chandra sekaran Newbie

                                I have similar issue while deploying on Jboss AS 7.1.0

                                 

                                 

                                08:19:20,854 ERROR [org.jboss.msc.service.fail94] MSC00001: Failed to start service jboss.deployment.subunit."spinnaker_im.ear"."portal-web-complete.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."spinnaker_im.ear"."portal-web-complete.war".INSTALL: Failed to process phase INSTALL of subdeployment "portal-web-complete.war" of deployment "spinnaker_im.ear"

                                at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]

                                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_31]

                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_31]

                                at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]

                                Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014543: No EJB found with interface of type 'com.liferay.portal.ejb.AddressLocalManagerHome' and name 'com_liferay_portal_ejb_AddressLocalManager' for binding java:module/env/ejb/liferay/AddressLocalManagerHome

                                at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:88)

                                at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:227)

                                at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:118)

                                at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]

                                ... 5 more

                                 

                                my web.xml entries have

                                <?xml version="1.0"?>
                                <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

                                <web-app>

                                ....
                                ....

                                  <ejb-local-ref> 
                                  <ejb-ref-name>ejb/liferay/AddressLocalManagerHome</ejb-ref-name>

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

                                  <local-home>com.liferay.portal.ejb.AddressLocalManagerHome</local-home>

                                  <local>com.liferay.portal.ejb.AddressLocalManager</local>

                                  <ejb-link>com_liferay_portal_ejb_AddressLocalManager</ejb-link>

                                </ejb-local-ref>
                                </webapp>

                                how do i fix with this, please help somebody.

                                 

                                Thanks,

                                Chandru

                                • 14. Re: EJB 2.0 on JBoss AS 7.1CR1
                                  Nicklas Karlsson Master

                                  Please start new threads (one per issue) or people will stop reading all posts containing the word "spinnaker" ;-)