4 Replies Latest reply on Aug 29, 2012 8:53 AM by sjayakumar

    Failing to deploy Session Bean

    sjayakumar

      Hi All,

      I am newbie to EJB I need some help to resolve the issue that I'm facing currently.

       

      I porting the existing EJB application to another product and both the products are having the same environment as in using JBoss 5.1.0 GA version. The issue that I'm facing was the deployment of Session Beans fails due to "NullPointerException" and from the exception and from the code trace (Jboss deployment source code) it looks like the ejb-jar.xml is not available for processing inspite of being part of the EJB-JAR file.

       

      Code snippet (JBoss source code)

       

      public void initialise(JBossMetaData dd)

      {

        this.interceptorsXml = dd.getInterceptors();

         ....

      }

       

      DD must be coming in as null, but I'm not sure why 'DD' is coming null? Does it mean ejb-jar.xml part of EJB-JAR (liTargetProvisioningEJB.jar) is not available for the EJB container to load/process? Please let me know how to address this issue.


      Any help regarding this is greatly appreciated.

       

       

      Please find the stack trace below:

       

      2012-08-28 14:13:11,399 DEBUG [main] Ejb3Deployment - EJB3 deployment time took: 1

      2012-08-28 14:13:11,399 DEBUG [main] Ejb3Deployer - ********* Ejb3Deployer Begin Unit: liTargetProvisioningEJB.jar jar: liTargetProvisioningEJB.jar

      2012-08-28 14:13:11,400 DEBUG [main] Ejb3Deployment - error trying to stop ejb deployment: null

      javax.management.RuntimeOperationsException

              at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:512)

              at org.jboss.mx.server.MBeanServerImpl.unregisterMBean(MBeanServerImpl.java:383)

              at org.jboss.ejb3.Ejb3Deployment.unregisterDeployment(Ejb3Deployment.java:440)

              at org.jboss.ejb3.Ejb3Deployment.destroy(Ejb3Deployment.java:747)

              at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:501)

              at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:182)

              at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:99)

              at org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer.internalDeploy(AbstractVFSRealDeployer.java:45)

              at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)

              at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)

              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)

              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)

              at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)

              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:361)

              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)

              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

              at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)

              at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)

              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:636)

      Caused by: java.lang.IllegalArgumentException: null object name

              ... 40 more

      2012-08-28 14:13:11,400 DEBUG [main] Ejb3Deployer - Error during deploy: vfszip:/opt/sonus/ema/jboss/server/sbxema/deploy/liTargetProvisioning.ear/liTargetProvisioningEJB.jar/

      org.jboss.deployers.spi.DeploymentException: Error deploying liTargetProvisioningEJB.jar: null

              at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:196)

      at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:99)

              at org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer.internalDeploy(AbstractVFSRealDeployer.java:45)

              at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)

              at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)

              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)

              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)

              at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)

              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:361)

              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)

              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

              at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)

              at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)

              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:636)

      Caused by: java.lang.NullPointerException

              at org.jboss.ejb3.interceptor.InterceptorInfoRepository.initialise(InterceptorInfoRepository.java:107)

              at org.jboss.ejb3.Ejb3HandlerFactory$DDFactory.<init>(Ejb3HandlerFactory.java:48)

              at org.jboss.ejb3.Ejb3HandlerFactory.getInstance(Ejb3HandlerFactory.java:83)

              at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:611)

              at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:491)

              at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:182)

              ... 34 more

       

       

      Thanks,

      Senthil Jayakumar

       

      Message was edited by: Senthil Jayakumar

        • 1. Re: Failing to deploy Session Bean
          cfang

          Can you post a reproducible test app?  I suspect some incorrect application configuration (ejb-jar.xml, etc) might have caused in a bad state.

          • 2. Re: Failing to deploy Session Bean
            sjayakumar

            Hi,

             

            I am sorry I don't have test app which may exactly reproduce this issue, as I already mentioned I was porting an existing application to another product.

             

            note: I was trying now removing both ejb-jar.xml and jboss.xml from the EJB jar file and wanted to see if there is different error like config file is missing or something similar but fortunately it worked, I am still wondering how it worked, meaning I did not see any exception but I am sure this may not be the solution I am fearing that I may be getting some issue later, so need your help but I'm sure this info is helpful to you.

             

            Please see my ejb-jar.xml and jboss.xml.

             

            <?xml version="1.0"?>

            <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>

             

            ejb-jar.xml

             

            <ejb-jar>

              <enterprise-beans>

                <session>

                  <ejb-name>LawfulInterceptTargetSessionBean</ejb-name>

                  <home>com.sonus.ems.lawfulintercept.litarget.beans.provisioning.api.LawfulInterceptTargetSessionHome</home>

                  <remote>com.sonus.ems.lawfulintercept.litarget.beans.provisioning.api.LawfulInterceptTargetSession</remote>

                  <ejb-class>com.sonus.ems.lawfulintercept.litarget.beans.provisioning.api.LawfulInterceptTargetSessionBean</ejb-class>

                  <session-type>Stateless</session-type>

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

                </session>

              </enterprise-beans>

            </ejb-jar>

             

            jboss.xml

             

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

            <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">

              <jboss>

              <enterprise-beans>

                <session>

                <ejb-name>LawfulInterceptTargetSessionBean</ejb-name>

                <jndi-name>LawfulIntercept/LIProvisoning</jndi-name>

                </session>

                </enterprise-beans>

            </jboss>

             

            Also note that I tried replacing DTD declartion with XSD but it didnt help... so there is no difference in replacing the declaration with XSD.

             

            Please see if you can help me by answering some of my below queries:

            1) How to check if my Session bean has be successfully register etc.

            2) How removing ejb-jar.xml and jboss.xml actually worked, I know ejb-jar.xml is optional in ejb 3 but how about jboss.xml?

            3) JbossMetaData is refereing to ejb-jar.xml only or it referes both ejb-jar.xml and jboss.xml... what my understanding was it referes only ejb-jar.xml only (as I understood from the JBoss source code).

             

            Thanks,

            Senthil Jayakumar

            • 3. Re: Failing to deploy Session Bean
              cfang

              Since your app worked without the 2 xml, I guess ejb classes have annotations.  So you need to update ejb-jar.xml to ejb 3.0 or 3.1 schema by replacing the header.  Another issue is your jboss.xml is also old, and I'm not sure if you can use the old version of jboss.xml with the newer app.  If your application annotations are sufficient for the app metadata (which looks so to me), you can remove the 2 xml files.

               

              My theory is the server detects the presence of ejb-jar.xml, but later found out the incorrect version, which left dd to null.

              • 4. Re: Failing to deploy Session Bean
                sjayakumar

                Hi,

                 

                Acutally the issue is still exist just that no exception was thrown... since depolyment was not having issues it allowed web services to run so I assumed that everything went fine... today while I was trying to see the registered MBEANS using jmx-console the mbean details were missing and also the jndi name lookup failed.

                 

                I have updated the schema and still observing the same error:

                 

                The xml files are updated with the xsd :

                 

                jboss.xml

                 

                <?xml version="1.0"?>

                <jboss xmlns="http://www.jboss.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_5_0.xsd" version="3.0">

                  <enterprise-beans>

                    <session>

                    <ejb-name>LawfulInterceptTargetSessionBean</ejb-name>

                    <jndi-name>LawfulIntercept/LIProvisoning</jndi-name>

                    </session>

                  </enterprise-beans>

                </jboss>

                 

                ejb-jar.xml

                 

                <?xml version="1.0"?>

                <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">

                  <enterprise-beans>

                    <session>

                      <ejb-name>LawfulInterceptTargetSessionBean</ejb-name>

                      <home>com.sonus.ems.lawfulintercept.litarget.beans.provisioning.api.LawfulInterceptTargetSessionHome</home>

                      <remote>com.sonus.ems.lawfulintercept.litarget.beans.provisioning.api.LawfulInterceptTargetSession</remote>

                      <ejb-class>com.sonus.ems.lawfulintercept.litarget.beans.provisioning.api.LawfulInterceptTargetSessionBean</ejb-class>

                      <session-type>Stateless</session-type>

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

                    </session>

                  </enterprise-beans>

                </ejb-jar>

                 

                Seems like EJB3 - has entirely different way of defining home/remote interfaces and session bean with annotation tags embedded.

                 

                Thanks,

                Senthil Jayakumar