[jboss-jira] [JBoss JIRA] (JBAS-8818) CDI injection not working in WebListeners

Archimedes Trajano (JIRA) issues at jboss.org
Mon May 8 19:22:00 EDT 2017


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

Archimedes Trajano commented on JBAS-8818:
------------------------------------------

This still applies to WildFly 10.  I am attempting to port my application which works properly on WebSphere Liberty and WebSphere 9.0 to WildFly and fixed most of the weird nuances such as...

JPQL not supporting `NOT p.cancelled` and having to use p.cancelled = false`

Using an undocumented (at least  not in https://docs.jboss.org/author/display/AS71/Deployment+Descriptors+used+In+AS7.1) jboss-app descriptor to set up the reference to the data source and adding a lookup name to it which I didn't need to do in WebSphere.

Changing the scope of JPA Converters and using an explicit InitialContext lookup for SessionContext since @Resource didn't work in JPA Event Listeners.

This problem with EJBs not being injected in WebListener also applies to WebService, WebServlet and JAX-RS as well.

> CDI injection not working in WebListeners
> -----------------------------------------
>
>                 Key: JBAS-8818
>                 URL: https://issues.jboss.org/browse/JBAS-8818
>             Project: Application Server 3  4  5 and 6
>          Issue Type: Bug
>          Components: Weld/CDI
>    Affects Versions: 6.0.0.Final
>            Reporter: Nicklas Karlsson
>            Assignee: Marius Bogoevici
>
> CDI injection is not performed for WebListeners, e.g.
> @WebListener
> public class BugListener implements HttpSessionListener
> {
>    @Inject
>    BeanManager beanManager;
>    ...
> }
> Will have beanManager==null when the methods are hit



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list