[jboss-jira] [JBoss JIRA] (WFLY-7252) war bean not visible for injection

Stuart Douglas (JIRA) issues at jboss.org
Mon Oct 3 17:14:01 EDT 2016


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

Stuart Douglas commented on WFLY-7252:
--------------------------------------

Relevant spec sections:

CDI 5.1

"A bean packaged in a certain module is available for injection, lookup and EL resolution to classes and JSP/JSF pages packaged in some other module if and only if the bean class of the bean is required to be accessible to the other module by the class accessibility requirements of the module architecture. In the Java EE module architecture, a bean class is accessible in a module if and only if it is required to be accessible according to the class loading requirements defined by the Java EE platform specification."

>From the Java EE spec EE.8.3.1:

"Components in the web container must not have access to the following classes and resources, unless such classes or resources are covered by one of the rules above.
• Other classes or resources in the application package. For example, the appli- cation should not have access to the classes in application client jar files."

This means that wars cannot see the contents of other wars, and beans deployed in the them are not available for injection outside the war. 






> war bean not visible for injection
> ----------------------------------
>
>                 Key: WFLY-7252
>                 URL: https://issues.jboss.org/browse/WFLY-7252
>             Project: WildFly
>          Issue Type: Bug
>          Components: CDI / Weld
>    Affects Versions: 10.0.0.Final, 10.1.0.Final
>            Reporter: Teresa Miyar
>            Assignee: Stuart Douglas
>            Priority: Critical
>         Attachments: DemoProjects.zip
>
>
> In an ear file 2 wars and one shared lib, warA provides implementation for shared lib, warB cannot see warA implementation even though our documentation on chapter 12 states:
> Chapter 12. Packaging and dep...
> • In an application deployed as an ear, the container searches every bean archive bundled with
> or referenced by the ear, including bean archives bundled with or referenced by wars, EJB jars
> and rars contained in the ear. The bean archives might be library jars, EJB jars or war WEB-
> INF/classes directories.
> Then we have this:
> See also the "5.1. Modularity",
> http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#selection:
> "A bean packaged in a certain module is available for injection, lookup and EL resolution to classes and JSP/JSF pages packaged in some other module if and only if the bean class of the bean is required to be accessible to the other module by the class accessibility requirements of the module architecture."
> "In the Java EE module architecture, a bean class is accessible in a module if and only if it is required to be accessible according to the class loading requirements defined by the Java EE platform specification."
> But the JavaEE spec states it "may" have access... it did have access on EAP6, does not have access on EAP7.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the jboss-jira mailing list