1 Reply Latest reply on Jan 25, 2013 3:13 PM by Marko Lukša

    ContextNotActivatedException for remote EJB calls

    raylite3 Apprentice

      Hello,

      I am using JBoss 7.1.3.Final. I have a simple HelloWorld EJB that I am invoking remotely from a standalone client. I recently turned on CDI by including beans.xml but I am not using @Inject in this EJB. But I am finding that thread dumps show the Weld classes involved in a number of places and I suspect causing some performance hit.

       

      I ran a load test (25 concurrent threads from client each invoking EJB repeatedly) to take the thread dumps. The two stacks that I wanted to discuss are below. In the first stack trace, the code always throws this exception since in this case it is a remote EJB call and the request scope is not set. Is there some way I should initialize the request scope for remote EJB calls? The second stack is because the AttributeBeanStore has logging calls without checking for the log level first. Can I file a bug for this?

       

      java.lang.Thread.State: RUNNABLE

              at java.lang.Throwable.fillInStackTrace(Native Method)

              - locked <0x00000000f39f58f8> (a org.jboss.weld.context.ContextNotActiveException)

              at java.lang.Throwable.<init>(Throwable.java:181)

              at java.lang.Exception.<init>(Exception.java:29)

              at java.lang.RuntimeException.<init>(RuntimeException.java:32)

              at javax.enterprise.context.ContextException.<init>(ContextException.java:34)

              at javax.enterprise.context.ContextNotActiveException.<init>(ContextNotActiveException.java:38)

              at org.jboss.weld.context.ContextNotActiveException.<init>(ContextNotActiveException.java:41)

              at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:581)

              at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:73)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

              at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:226)

              at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:302)

              at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:188)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.jav

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.j

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:42)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:43)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

              at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)

              at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.invokeMethod(MethodInvocationMessageHandler.java:321)

              at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$100(MethodInvocationMessageHandler.java:69)

              at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:202)

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

              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

              at java.util.concurrent.FutureTask.run(FutureTask.java:138)

              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)

              at org.jboss.threads.JBossThread.run(JBossThread.java:122)

       

       

      "EJB default - 3" prio=6 tid=0x000000000791d800 nid=0xc40 runnable [0x0000000015afe000]

         java.lang.Thread.State: RUNNABLE

              at java.lang.Object.hashCode(Native Method)

              at java.lang.Object.toString(Object.java:219)

              at java.lang.String.valueOf(String.java:2826)

              at java.lang.StringBuilder.append(StringBuilder.java:115)

              at org.jboss.weld.context.beanstore.AttributeBeanStore.detach(AttributeBeanStore.java:71)

              at org.jboss.weld.context.AbstractBoundContext.deactivate(AbstractBoundContext.java:71)

              at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:97)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)