[jboss-jira] [JBoss JIRA] Commented: (EJBTHREE-2256) ExtendedEntityManager injected into Stateless Session Bean

Dirk Gerrit Oort (JIRA) jira-events at lists.jboss.org
Tue Sep 20 14:42:27 EDT 2011


    [ https://issues.jboss.org/browse/EJBTHREE-2256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12629437#comment-12629437 ] 

Dirk Gerrit Oort commented on EJBTHREE-2256:
--------------------------------------------

one detail the enitymanager on the singelton is not an extended entity manager but the function is called from a stateful session bean with an extended entity manager

> ExtendedEntityManager injected into Stateless Session Bean
> ----------------------------------------------------------
>
>                 Key: EJBTHREE-2256
>                 URL: https://issues.jboss.org/browse/EJBTHREE-2256
>             Project: EJB 3.0
>          Issue Type: Bug
>          Components: injection
>         Environment: Running Arquillian 1.0.0.Alpha5 JUnit testcase with jbossas-remote-6 in jboss-6.0.0.Final
>            Reporter: gunter zeilinger
>            Assignee: jaikiran pai
>         Attachments: com.acme.jpa.UserRepositoryTestCase.txt, extended-entity-manager-in-slsb.zip
>
>
> Injecting a Stateless and a Stateful Session Bean - the later with an Extended Presentation Context - into a managed object:
> {code}
> @RunWith(Arquillian.class)
> public class MyTest {
> @EJB
> private MySFSB sfsb;
> @EJB
> private MySLSB slsb;
> :
> {code}
> may cause that the {{ExtendedEntityManager}} from the SFSB get also injected into the SLSB, which results in:
> {noformat}
> 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)
> ...
> {noformat}
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list