8 Replies Latest reply on Jun 21, 2012 5:18 AM by manoj.m.agarwal

    Issue while deploying EJB 3 with JBoss AS 7

    manoj.m.agarwal

      Hi,

       

      I am trying to deploy a SLSB with  annotations @Singleton and @Startup. I packaged it as a jar and put it under standalone/deployments.

       

      I get this error while starting server. Any help will be very helpful.

       

      11:35:22,844 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."xyz-startup-bean-3.0.0-SNAPSHOT.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."xyz-startup-bean-3.0.0-SNAPSHOT.jar".POST_MODULE: Failed to process phase POST_MODULE of deployment "xyz-startup-bean-3.0.0-SNAPSHOT.jar"

      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.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.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_02]

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_02]

      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_02]

      Caused by: java.lang.NullPointerException

      at org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:53) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

      at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:63)

      at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)

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

      ...............................

        • 1. Re: Issue while deploying EJB 3 with JBoss AS 7
          swd847

          Does your deployment contain OSGI manifests?

          • 2. Re: Issue while deploying EJB 3 with JBoss AS 7
            manoj.m.agarwal

            No...it doesn't. If it needs to have OSGI then please let me know how to do it because i am not much aware of it.

             

            Thanks !

            • 3. Re: Issue while deploying EJB 3 with JBoss AS 7
              lafr

              Can you show us the code of the bean?

              You're using any xml files in you deployment unit?

              Show us a jar -tvf xyz-startup-bean-3.0.0-SNAPSHOT.jar.

              • 4. Re: Issue while deploying EJB 3 with JBoss AS 7
                manoj.m.agarwal

                Hi Frank,

                 

                I was following another thread where you suggested EJB option for invoking something while JBoss startup .(https://community.jboss.org/thread/201070)

                 

                Jaikiran made a correction in your suggestion, and now this error is gone but another issue is surfaced.....

                 

                Now my jar is getting deployed but init method(annotated with @PostConstruct) is not getting invoke.

                 

                This is my bean class...

                 

                  package com.abc.xyz;
                 
                  import javax.annotation.PostConstruct;
                  import javax.ejb.Startup;
                  import javax.inject.Singleton;
                 
                  @Singleton
                  @Startup
                  public class xyzStartupBean
                  {

                      public xyzStartupBean()
                      {
                          System.out.println("bean instance created");
                        
                      }
                 
                      @PostConstruct
                      public void init()
                      {
                          System.out.println("post construct....");
                      }
                }

                 

                 

                Attached is the output of jar-tvf .................

                 

                    0 Tue Jun 19 14:45:34 IST 2012 META-INF/
                  214 Tue Jun 19 14:45:32 IST 2012 META-INF/MANIFEST.MF
                    0 Tue Jun 19 14:45:34 IST 2012 com/
                    0 Tue Jun 19 14:45:34 IST 2012 com/abc/
                    0 Tue Jun 19 14:45:34 IST 2012 com/abc/xyz/
                  714 Tue Jun 19 14:45:34 IST 2012 com/abc/xyz/XyzStartupBean.class
                  395 Tue Jun 19 14:45:34 IST 2012 META-INF/ejb-jar.xml
                1667 Tue Jun 19 14:45:34 IST 2012 META-INF/harvest.sig
                    0 Tue Jun 19 14:45:36 IST 2012 META-INF/maven/
                    0 Tue Jun 19 14:45:36 IST 2012 META-INF/maven/xyz/
                    0 Tue Jun 19 14:45:36 IST 2012 META-INF/maven/xyz/xyz-startup-bean/
                1649 Tue Jun 19 11:30:54 IST 2012 META-INF/maven/xyz/xyz-startup-bean/pom.xml
                  124 Tue Jun 19 14:45:34 IST 2012 META-INF/maven/xyz/xyz-startup-bean/pom.properties

                 

                In ejb-jar.xml i have just <display-name> and MANIFEST.MF have just version.

                Please let me know if i need to do some explicit configuration, so that init() get invoke while JBoss startup.

                 

                 

                Thanks !
                 

                • 5. Re: Issue while deploying EJB 3 with JBoss AS 7
                  jaikiran

                  import javax.inject.Singleton;

                  Wrong import! It should be javax.ejb.Singleton.

                  • 6. Re: Issue while deploying EJB 3 with JBoss AS 7
                    manoj.m.agarwal

                    Hi Jaikiran,

                     

                    I corrected the import stmnt...now i am ending up with the same exception what i posted in the starting of this thread

                    • 7. Re: Issue while deploying EJB 3 with JBoss AS 7
                      dmlloyd

                      A NullPointerException is always a bug.  That said, it would be helpful if you could open a JIRA at http://issues.jboss.org/browse/AS7 containing the stack trace and an EJB JAR which reproduces the issue, along with the corresponding source code.

                       

                      Thanks!

                      1 of 1 people found this helpful
                      • 8. Re: Issue while deploying EJB 3 with JBoss AS 7
                        manoj.m.agarwal

                        I opened a JIRA bug for it.

                        Thanks David