Bug 921004 - CDI injection into JAX-RS service does not work when hot-deployed.
Summary: CDI injection into JAX-RS service does not work when hot-deployed.
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CDI/Weld, RESTEasy
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Stuart Douglas
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-13 09:59 UTC by Pavel Macik
Modified: 2016-08-02 16:15 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-03-16 05:14:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker AS7-6723 0 Major Resolved CDI injection into JAX-RS service does not work when hot-deployed. 2016-06-01 08:32:47 UTC
Red Hat Issue Tracker RESTEASY-841 0 Major Closed No error is thrown if the same class is present in both Application.getClasses() and Application.getSingletons() 2016-08-02 16:15:29 UTC

Description Pavel Macik 2013-03-13 09:59:52 UTC
To reproduce the issue use following steps:
1.) Get the reproducer from git://github.com/pmacik/jaxrs-cdi-reproducer.git
2.) Get out-of-the-box JBoss AS7 (7.1.1.Final)
3.) Start the AS up
4.) Build the reproducer WAR using "mvn package"
5.) Deploy the reproducer WAR - copy the WAR into (JBOSS_HOME)/standalone/deployments directory
6.) Go to http://localhost:8080/JAXRS-CDI-reproducer/rest/bean/getAll -> NPE is thrown (bean was not injected)
7.) Go to http://localhost:8080/JAXRS-CDI-reproducer/BeanServlet -> the bean is properly injected


There is a workaround - deploy WAR before AS start-up.

Comment 1 Stuart Douglas 2013-03-16 04:26:38 UTC
Hot deployment does not actually have anything to do with it. It appears to be a race condition in deployment, sometimes it works and sometimes it does not.

Comment 2 Stuart Douglas 2013-03-16 05:13:23 UTC
This is actually caused by user error. In the reproducer the class should only be returned by Application.getClasses(), not Application.getSingletons(). 

Ideally RESTeasy would detect this case, and would throw an error. I have filed an issue against RESTeasy to detect this problem.

Comment 3 JBoss JIRA Server 2013-03-16 05:14:57 UTC
Stuart Douglas <stuart.w.douglas> updated the status of jira AS7-6723 to Resolved

Comment 4 JBoss JIRA Server 2016-05-11 21:08:37 UTC
Ron Sigal <ron.sigal> updated the status of jira RESTEASY-841 to Resolved

Comment 5 JBoss JIRA Server 2016-08-02 16:15:30 UTC
Alessio Soldano <asoldano> updated the status of jira RESTEASY-841 to Closed


Note You need to log in before you can comment on or make changes to this bug.