[jboss-jira] [JBoss JIRA] Commented: (EJBTHREE-1889) @EJB injection into @Service bean leads to NullPointerException when injected bean is redepolyed

Carlo de Wolf (JIRA) jira-events at lists.jboss.org
Wed Nov 11 04:24:06 EST 2009


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

Carlo de Wolf commented on EJBTHREE-1889:
-----------------------------------------

The first problem is that on restart the container looses its enc injectors. Effectively that means that there is no longer a reference in java:comp that can be injected into the field. Thus the NPE. This is alleviated by reconstructing the injectors.

The second problem is that interfaces might be loaded from a different class loader. Right now there is no provisioning that can determine the class loader dependency chain automatically. The only work around is to package the interface within the consuming deployment unit. This also entails that using local views (call by reference) doesn't work. So only remote views can be used in this manner.

> @EJB injection into @Service bean leads to NullPointerException when injected bean is redepolyed
> ------------------------------------------------------------------------------------------------
>
>                 Key: EJBTHREE-1889
>                 URL: https://jira.jboss.org/jira/browse/EJBTHREE-1889
>             Project: EJB 3.0
>          Issue Type: Bug
>    Affects Versions: 1.1.10
>            Reporter: Mike Clark
>            Assignee: Carlo de Wolf
>            Priority: Critical
>             Fix For: 1.1.21
>
>         Attachments: EJBAnnotationTest.zip, EJBTHREE-1889-unit-test.patch
>
>
> I have two @Service jars, service "A" and "B" where "B" injects an instance of "A" using the @EJB annotation with a mappedName attribute set to the default jndi location of A ("EJBTestAService/local" in the example provided.)  When deployed, they work fine.  But, if "A" is redeployed, access to "B" fails due to a NullPointerException, the reference to "A" is null.
> To reproduce with the attached code:
> 1.) Set jboss.home property in build.xml
> 2.) Start EAP 5, beta
> 3.) ant deployAll (will compile and deploy the two jars)
> 4.) ant run (runs test client against "B")
> 5.) ant undeployA (Should see "B" stop, then "A" stop)
> 6.) ant deployA (Should see "A" start, then "B" start)
> 7.) ant run (will fail with NullPointerException as root cause)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list