1 2 Previous Next 22 Replies Latest reply on Feb 24, 2009 8:36 AM by jaikiran

    NullPointerException in JavaEEComponentHelper with JBoss-5.0

    jimmycallaghan

      Well it's official. I've now posted more to the forum in two days than I have in the last 2 years. Sorry to bug you guys again but there's not too much help out there yet on JBoss.CR1. Hope my posts, and your fine solutions, help people in the future.

      Anyway, I'm still having problems deploying. My EARs all deploy fine to JBoss5 Beta4 but I'm getting the following stack trace when deploying to JBoss5 CR1.

      15:06:22,674 DEBUG [Ejb3Deployer] Error during deploy: vfszip:/home/jim/messaging-platform/jboss-5.0.0.CR1/server/custom1/deploy/webs/10.mpee.local.20080702.1514.ear
      org.jboss.deployers.spi.DeploymentException: Error deploying 10.mpee.local.20080702.1514.ear: null
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:192)
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:95)
       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:174)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:970)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:911)
       at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1392)
       at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:784)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:912)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:834)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:672)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:455)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:594)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:541)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:257)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:135)
       at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:409)
       at org.jboss.Main.boot(Main.java:209)
       at org.jboss.Main$1.run(Main.java:544)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NullPointerException
       at org.jboss.ejb3.javaee.JavaEEComponentHelper.createObjectName(JavaEEComponentHelper.java:46)
       at org.jboss.ejb3.deployers.JBoss5DeploymentScope.getEjbContainer(JBoss5DeploymentScope.java:167)
       at org.jboss.ejb3.Ejb3Deployment.getEjbContainer(Ejb3Deployment.java:384)
       at org.jboss.ejb3.EJBContainer.resolveEjbContainer(EJBContainer.java:1324)
       at org.jboss.injection.AbstractHandler.addDependency(AbstractHandler.java:50)
       at org.jboss.injection.EJBRemoteHandler.ejbRefDependency(EJBRemoteHandler.java:143)
       at org.jboss.injection.EJBRemoteHandler.handleFieldAnnotations(EJBRemoteHandler.java:371)
       at org.jboss.injection.InjectionUtil.processFieldAnnotations(InjectionUtil.java:162)
       at org.jboss.injection.InjectionUtil.processAnnotations(InjectionUtil.java:199)
       at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:563)
       at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:392)
       at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:505)
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:185)
       ... 21 more


      I don't really have much more than I can add to this because I'm not really told much more in the log. I've set logging so that "org.jboss" is at DEBUG and I do have a lot of other logging but nothing that seems to relate to this issue.

      I've checked out the source of the JavaEEComponentHelper class:

      public static String createObjectName(JavaEEModule module, String unitName, String ejbName)
      {
       // TODO: currently it's only for EJB3 service
       StringBuilder sb = new StringBuilder(Ejb3Module.BASE_EJB3_JMX_NAME + ",");
       JavaEEApplication ear = module.getApplication();
       if (ear != null)
       {
       sb.append("ear=");
       sb.append(ear.getName());
       sb.append(",");
       }
       sb.append("jar=");
       sb.append(unitName);
       sb.append(",name=");
       sb.append(ejbName);
       try
       {
       ObjectName on = new ObjectName(sb.toString());
       return on.getCanonicalName();
       }
       catch (MalformedObjectNameException e)
       {
       throw new RuntimeException(e);
       }
      }


      So I believe that the JavaEEModule object that is being passed in must be null. Unfortunately I can't see where this module name is set. Is it part of the WAR or maybe an entry in application.xml?

      Again, any insight is very much appreciated.

        • 1. Re: NullPointerException in JavaEEComponentHelper with JBoss
          starksm64

          It should be an ejb3 deployment. It looks like the ejb that is being resolved does not map to an Ebj3Deployment in the JBoss5DeploymentScope.getEjbContainer method. I would have to see an ear that is causing this problem. Can you create a jira issue with one?

          http://jira.jboss.org/jira/browse/JBAS

          • 2. Re: NullPointerException in JavaEEComponentHelper with JBoss
            jimmycallaghan
            • 3. Re: NullPointerException in JavaEEComponentHelper with JBoss
              gcoleman

              I'm getting this exception too. The ear contains a mixture of EJB2 modules and EJB3 ones. Some of the EJB3 beans depend on EJB2 ones (via ejb-local-refs). Could this be what's triggering the bug?

              • 4. Re: NullPointerException in JavaEEComponentHelper with JBoss
                tvanbuskirk

                 

                I'm getting this exception too. The ear contains a mixture of EJB2 modules and EJB3 ones. Some of the EJB3 beans depend on EJB2 ones (via ejb-local-refs). Could this be what's triggering the bug?

                I am getting this exception as well. All of mine are EJB3 beans, so I don't think it's a problem of a mixture of EJB2 and EJB3. The beans deploy fine on 4.2.2.GA and 5.0.0.Beta4.
                Also, if it helps, it seems that all of the EJBs that fail are injecting other EJBs inside the same ear. My EARs that have EJBs that inject EJBs inside different EARs seem to get deployed without problems, though I don't know if I can confirm that.

                • 5. Re: NullPointerException in JavaEEComponentHelper with JBoss
                  bus387

                  I got this same error stack. and my ear worked well in production jboss4.2.2GA.

                  ear contains three ejb3 modules and use @EJB inject the depended ejb.

                  • 6. Re: NullPointerException in JavaEEComponentHelper with JBoss
                    jeffbrooks

                    I'm using JBoss 5.0.0.cr2.

                    I have a few ejb2, and ejb3 modules that deploy without problems.

                    I'm getting this error on one specific module in my application. The module is ejb3 based.

                    Has anyone figured out what is causing this error? Is there any way to change the module and/or code to work around this defect?

                    It only happens with some modules so if the reason that causes this failure is identified it may be possible to work around it in the short term.

                    Jeff Brooks

                    • 7. Re: NullPointerException in JavaEEComponentHelper with JBoss
                      wolfc

                      It appears that for any EJB3 annotated classes found on the ear's classpath the Ejb3Deployer gets booted. Most likely the OptAnnotationDeployer creates EJB meta data for the ear.

                      If possible try to contain the EJB3 classes to an ejb module and make sure it's not in any library directory of the ear.

                      • 8. Re: NullPointerException in JavaEEComponentHelper with JBoss
                        jeffbrooks

                        I found a work around.

                        I removed all @EJB annotations and used a utility class to get the ejbs from jndi.

                        Jeff Brooks

                        • 9. Re: NullPointerException in JavaEEComponentHelper with JBoss
                          gcoleman

                          That's a pretty rubbish workaround. The only one I've come up with that doesn't involve lots of changes to existing code is to not use JBoss 5. It's very disappointing.

                          • 10. Re: NullPointerException in JavaEEComponentHelper with JBoss
                            wolfc

                            Couldn't agree more. I think the underlying issue is: https://jira.jboss.org/jira/browse/JBAS-5895, but I want to be sure.

                            So making sure the actual EJBs are not in a jar which is in lib (optionally specifying it as an ejb module in application.xml) should resolve the problem.

                            • 11. Re: NullPointerException in JavaEEComponentHelper with JBoss
                              jeffbrooks

                              Interesting responses.

                              That's a pretty rubbish workaround. The only one I've come up with that doesn't involve lots of changes to existing code is to not use JBoss 5. It's very disappointing.


                              GColeman, I only had to remove two @EJB annotations because the application I'm working on is mostly ejb2.

                              The only other option appeared to be reworking how everything is packaged which in my case would have taken significantly longer than the few minutes it took to remove the annotations.

                              Couldn't agree more.


                              Wolfc, I assume you agree with the rubbish comment and not with GColeman's comment about how disappointing JBoss 5 is.

                              So making sure the actual EJBs are not in a jar which is in lib (optionally specifying it as an ejb module in application.xml) should resolve the problem.


                              Rubbish! ;-)

                              Your suggestion will take significantly longer than removing two @EJB annotations.

                              I'm not arguing that removing the @EJB is a good solution but in my case it is a very simple way of getting my application deployed on JBoss 5. It appears that this isn't an option for GColeman.

                              What I really want is for JBoss 5 to be able to handle @EJB annotations correctly without any workarounds.

                              Jeff Brooks


                              • 12. Re: NullPointerException in JavaEEComponentHelper with JBoss
                                wolfc

                                 

                                "JeffBrooks" wrote:
                                ...
                                Wolfc, I assume you agree with the rubbish comment and not with GColeman's comment about how disappointing JBoss 5 is.

                                I didn't not expect such a bug to surface in CR2, so I'm just as disappointed with the situation as you guys. Not using JBoss AS 5 as a workaround, that is something I find rubbish. ;-)
                                "JeffBrooks" wrote:
                                So making sure the actual EJBs are not in a jar which is in lib (optionally specifying it as an ejb module in application.xml) should resolve the problem.


                                Rubbish! ;-)

                                Your suggestion will take significantly longer than removing two @EJB annotations.

                                I'm not arguing that removing the @EJB is a good solution but in my case it is a very simple way of getting my application deployed on JBoss 5. It appears that this isn't an option for GColeman.

                                What I really want is for JBoss 5 to be able to handle @EJB annotations correctly without any workarounds.

                                Jeff Brooks

                                Yup, so far I found 2 cases where JavaEEComponentHelper throws a NPE.
                                I want cover all bases, so we can get going without any workarounds.
                                How come my workaround is a bigger impact? It should just be a repacking.

                                • 13. Re: NullPointerException in JavaEEComponentHelper with JBoss
                                  jeffbrooks

                                   

                                  "wolfc" wrote:
                                  I didn't not expect such a bug to surface in CR2, so I'm just as disappointed with the situation as you guys. Not using JBoss AS 5 as a workaround, that is something I find rubbish. ;-)


                                  I sense a rubbish fad coming on! ;-)

                                  "wolfc" wrote:
                                  Yup, so far I found 2 cases where JavaEEComponentHelper throws a NPE.
                                  I want cover all bases, so we can get going without any workarounds.
                                  How come my workaround is a bigger impact? It should just be a repacking.


                                  The .ear that couldn't be deployed has 25 modules in it.

                                  The same .ear has two @EJB annotations in it.

                                  Removing two @EJB annotations takes less time than updating the packaging for 25 modules.

                                  Jeff Brooks


                                  • 14. Re: NullPointerException in JavaEEComponentHelper with JBoss

                                    Has this conversation moved on to another thread, or are people calling this done? I've run into the same problem on the 5.0 GA release...

                                    1 2 Previous Next