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.
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.
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.
Stuart Douglas <firstname.lastname@example.org> updated the status of jira AS7-6723 to Resolved
Ron Sigal <email@example.com> updated the status of jira RESTEASY-841 to Resolved
Alessio Soldano <firstname.lastname@example.org> updated the status of jira RESTEASY-841 to Closed