[jboss-jira] [JBoss JIRA] (WFLY-3640) EJB injection does not work in components added via Servlet Context

James Livingston (JIRA) issues at jboss.org
Fri Jul 18 01:38:30 EDT 2014


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

James Livingston edited comment on WFLY-3640 at 7/18/14 1:37 AM:
-----------------------------------------------------------------

Stuart said in conversation elsewhere (prior to WF 8.1 being released obviously):

"Unfortunately this won't work at the moment. The basic issue is that at the moment the deployment layer expects to be able to identify everything that needs to be injected at runtime and create a component model and dependencies for them. When you add a class this this the deployment layer has not created a component for the MyListener class, because it has not seen it.

There is not really any easy fix for this, although it is something that I would like to address in WF 8.1. Have you tried using CDI (i.e. putting a beans.xml in the jar with MyListener)? This should definitely work in WF upstream"


was (Author: jameslivingston):
Stuart said in conversation elsewhere (prior to WF 8.1 being release obviously):

"Unfortunately this won't work at the moment. The basic issue is that at the moment the deployment layer expects to be able to identify everything that needs to be injected at runtime and create a component model and dependencies for them. When you add a class this this the deployment layer has not created a component for the MyListener class, because it has not seen it.

There is not really any easy fix for this, although it is something that I would like to address in WF 8.1. Have you tried using CDI (i.e. putting a beans.xml in the jar with MyListener)? This should definitely work in WF upstream"

> EJB injection does not work in components added via Servlet Context
> -------------------------------------------------------------------
>
>                 Key: WFLY-3640
>                 URL: https://issues.jboss.org/browse/WFLY-3640
>             Project: WildFly
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Web (Undertow)
>    Affects Versions: 8.1.0.Final
>            Reporter: James Livingston
>            Assignee: Stuart Douglas
>         Attachments: reproducer.zip
>
>
> You can add web components at runtime ServletContext.addListener() and similar methods. @EJB injection inside those components does not work and the field remains null. I have not yet tested whether other forms of injection work or not.
> I'm attaching a test case which adds a listener via a ServletContainerInitializer.



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jboss-jira mailing list