0 Replies Latest reply on Nov 14, 2013 2:36 AM by bunty lava

    JBOSS EAP 5.2: EJB Timer throws null pointer exception when aop domain is added for EJB3 service in jboss.xml

    bunty lava Newbie

      Hi,

       

       

      I am using JBOSS EAP 5.2 as the server and I have created a EJB bean with time out method in it. I have also added a aop domain name for the EJB in jboss.xml as shown below,

       

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

      <jboss xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xml="http://www.w3.org/XML/1998/namespace"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee jboss_5_0.xsd ">

        <webservices>

          <context-root>service/helloService</context-root>

        </webservices>

       

        <enterprise-beans>

          <session>

            <ejb-name>helloService</ejb-name>

            <local-jndi-name>ejb/helloService/local</local-jndi-name>

            <aop-domain-name>Hello Service Stateless Bean</aop-domain-name>

          </session>

        </enterprise-beans>

      </jboss>

       

      and the ejb3-interceptors-aop.xml has the aop domain configuration. I ADDED THIS TO CUSTOMIZE THE MAX POOL SIZE AND IDEAL TIMEOUT LIMIT FOR MY HELLO SERVICE STATELESS BEAN. @POOL ANNOTATION WAS NOT USED IN CODE TO MAKE SURE THE CODE IS IN ALIGNMENT WITH JEE SPECIFICATION.

       

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

      <aop xmlns="urn:jboss:aop-beans:1.0">

        <domain name="Hello Service Stateless Bean" extends="Intercepted Bean" inheritBindings="true">

          <bind pointcut="execution(public * *->*(..))">

            <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor" />

            <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory" />

          </bind>

          <bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))">

            <interceptor-ref name="Basic Authorization" />

          </bind>

          <bind pointcut="execution(public * *->*(..))">

            <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory" />

          </bind>

          <bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..))">

            <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory" />

          </bind>

          <bind pointcut="execution(public * *->*(..))">

            <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor" />

            <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory" />

            <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor" />

            <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory" />

            <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor" />

            <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor" />

            <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->

            <stack-ref name="EJBInterceptors" />

          </bind>

          <annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)"> @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=50, timeout=10000)

          </annotation>

        </domain>

      </aop>

       

      The hello service implementation is given below and the timer gets created on calling sayHelloAfter30Sec service method, but on time out the null pointer exception is thrown

       

      @WebService...

      @Stateless....

      @HandlerChain...

      @Interceptors(LoggingInterceptor.class)

      @RunAs("me")

      public class HelloServiceImpl implements HelloService

      {

      @Resource

          TimerService timerService;

       

      @Timeout

          public void handleTimerOut(final Timer timer)

          {

              log("Hello there.....")

              My time Out code....

          }

        

          public sayHelloAfter5Sec()

          {

              timerService.createTimer(30000, myTimeOutObj);

          }

      }

       

      NULL POINTER EXCEPTION OCCURED ON TIME OUT is as below,

       

      java.lang.NullPointerException

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                      at java.lang.reflect.Method.invoke(Method.java:597)

                      at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)

                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)

                      at org.jboss.ejb3.stateless.StatelessContainer.callTimeout(StatelessContainer.java:684)

                      at org.jboss.ejb3.stateless.StatelessContainer.callTimeout(StatelessContainer.java:200)

                      at org.jboss.as.ejb3.timerservice.TimedObjectInvokerBridge.callTimeout(TimedObjectInvokerBridge.java:44)

                      at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:694)

                      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

                      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)

                      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)

                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)

                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)

                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)

                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                      at java.lang.Thread.run(Thread.java:662)

       

      THIS ISSUE OCCURRED WHEN MIGRATED TO JBOSS EAP 5.2, it was WORKING EARLIER.

       

      PLEASE HELP WHAT COULD E THE PROBLEM AND HOW TO FIX IT?

       

      THANKS IN ADVANCE.....