3 Replies Latest reply on Jun 10, 2011 5:47 PM by gunterze

    ExtendedEntityManager injected into Stateless Session Bean

    gunterze

      Running Arquillian 1.0.0.Alpha5 with jbossas-remote-6 using a Stateful and a Stateless Session Bean with no-interface view in MyTest:

       

      @RunWith(Arquillian.class)

      public class MyTest {

       

      @EJB

      private MySFSB sfsb;

       

      @EJB

      private MySLSB slsb;

      :

       

      and invoking a method of the SLSB after invoking a method of the SFSB, sometimes the SLSB got the ExtendedEntityManager of the SFSB injected, which causes:

       

      java.lang.NullPointerException

              at org.jboss.ejb3.entity.ExtendedEntityManager.getPersistenceContext(ExtendedEntityManager.java:76)

              at org.jboss.ejb3.entity.ExtendedEntityManager.getEntityManager(ExtendedEntityManager.java:61)

              at org.jboss.ejb3.jpa.integration.JPA2EntityManagerDelegator.createNamedQuery(JPA2EntityManagerDelegator.java:44)

              at MySLSB.foo(MySLSB.java:57)

              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.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:72)

              at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76)

              at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62)

      ...

       

      The failure does not occur on each run - sometimes the SLSB get its own org.jboss.jpa.tx.TransactionScopedEntityManager injected as expected, and the test passes.

       

      Is this a known bug of arquillian, jboss or tomcat?