2 Replies Latest reply on Apr 9, 2013 4:22 PM by raylite3

    Stateful session bean causes NPE when using container interceptor

    raylite3 Apprentice

      Hello,

      I am trying to add a container interceptor in jboss-ejb3.xml but get the following error. Any ideas please?

       

      11:24:29,490 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."testtx.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."testtx.war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "testtx.war"

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

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

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

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]

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

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

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011030: Could not configure component sample.RemoteStateful

                at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:91)

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

                ... 5 more

      Caused by: java.lang.NullPointerException

                at org.jboss.as.ejb3.component.EJBContainerInterceptorsViewConfigurator.doConfigure(EJBContainerInterceptorsViewConfigurator.java:143)

                at org.jboss.as.ejb3.component.EJBContainerInterceptorsViewConfigurator.configure(EJBContainerInterceptorsViewConfigurator.java:104)

                at org.jboss.as.ee.component.ComponentDescription$DefaultComponentConfigurator.configure(ComponentDescription.java:929)

                at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:80)

                ... 6 more

       

      It seems to happen when I configure the timeout in ejb-jar.xml which looks like this:

       

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

      <ejb-jar version="3.1" xmlns="http://java.sun.com/xml/ns/javaee"

                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">

                <display-name>Test Server</display-name>

       

       

                <enterprise-beans>

                          <session>

                                    <ejb-name>sample.RemoteStateful</ejb-name>

                                    <ejb-class>sample.StatefulSample</ejb-class>

                                    <session-type>Stateful</session-type>

                                    <stateful-timeout>

                                              <timeout>30</timeout>

                                              <unit>Seconds</unit>

                                    </stateful-timeout>

                          </session>

                </enterprise-beans>

      </ejb-jar>

       

      My jboss-ejb3.xml looks like this:

       

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

      <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"

          xmlns:ci ="urn:container-interceptors:1.0"

          version="3.1">

          <assembly-descriptor xmlns="http://java.sun.com/xml/ns/javaee">

              <ci:container-interceptors>

                  <!-- Default interceptor -->

                  <interceptor-binding>

                      <ejb-name>*</ejb-name>

                      <interceptor-class>sample.EjbContainerInterceptor</interceptor-class>

                  </interceptor-binding>           

              </ci:container-interceptors>

          </assembly-descriptor>   

      </jboss:ejb-jar>

       

      Have attached the Eclipse project I am using.

      Thanks in advance for any advice.