[GLASSFISH-19317] Injection of @PersistenceContext and @Resource in EAR's lib CDI beans does not work Created: 10/Nov/12  Updated: 08/Apr/13  Resolved: 08/Apr/13

Status: Resolved
Project: glassfish
Component/s: cdi
Affects Version/s: 3.1.2.2
Fix Version/s: 4.0_b84_RC1

Type: Bug Priority: Major
Reporter: titmus Assignee: jjsnyder83
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7 64bit, JDK 1.6.0_29 32bit


Attachments: Zip Archive jee-resources.zip    

 Description   

When a CDI bean is defined in a bean archive located in lib directory of an EAR archive GF does not properly inject values into fields annotated with @PersistenceContext or @Resource annotation.
The field is initalized with weld proxy but when a method is invoked on such field the NullInstanceException is raised: org.jboss.weld.exceptions.NullInstanceException: WELD-000044 Unable to obtain instance from null.

I found this discussion which seems to describe exactly the same problem:
http://www.java.net/forum/topic/glassfish/glassfish/persistencecontext-ignored-library-jar-classes?force=606

I attached a test case which demonstrates this bahaviour.



 Comments   
Comment by jjsnyder83 [ 08/Apr/13 ]

Committed revision 61234.

Generated at Thu Dec 08 17:10:29 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.