<font size=2 face="sans-serif">Thank you Martin!</font><br><br><font size=2 face="sans-serif">I interpreted this enablement differently.</font><br><br><font size=2 face="sans-serif">The CDI 1.2 spec states:</font><br><br><font size=3>A bean is said to be <i>enabled</i> if:</font><ul><li><font size=3>it is deployed in a bean archive, and</font><li><font size=3>it is not a producer method or field of a disabled bean,
and</font><li><font size=3>it is not specialized by any other enabled bean, as defined
in </font><a href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#specialization"><font size=3 color=blue><u>Specialization</u></font></a><font size=3>,
and either</font><li><font size=3>it is not an alternative, or it is a selected alternative
of at least one bean archive or the application.</font></ul><font size=3>Otherwise,
the bean is said to be disabled.</font><p><p><font size=2 face="sans-serif"> In the above app, there are two
jars. The jar beans-xml-modified2.jar.jar does not enable the alternative
and in its injection, it should only see the CounterProducerModified. While
in another jar, the alternative AlternativeCounterProducerModified completely
disabled the CounterProducerModified. Any injection in that jar should
only see the specialized bean.</font><p><font size=2 face="sans-serif">>From what you explained, the beans.xml
in one jar enabled the alternative bean and affect other jars. From my
understanding, the enablement of alternatives/interceptors are specific
for that archive and should not affect other jars. </font><p><font size=2 face="sans-serif">Also OpenWebBeans behaves differently
from Weld, and OpenWebBeans does what I have expected (enablement are per
jar only).</font><br><br><font size=2 face="sans-serif">Many thanks,<br>Emily<br>===========================<br>Emily Jiang<br>WebSphere Application Server, CDI Development Lead</font><br><font size=2 face="sans-serif"> <br>MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>Phone: +44 (0)1962 816278 Internal: 246278<br><br>Email: emijiang@uk.ibm.com <br>Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br></font><br><br><br><br><font size=1 color=#5f5f5f face="sans-serif">From:
</font><font size=1 face="sans-serif">Martin Kouba <mkouba@redhat.com></font><br><font size=1 color=#5f5f5f face="sans-serif">To:
</font><font size=1 face="sans-serif">Emily Jiang/UK/IBM@IBMGB,
</font><br><font size=1 color=#5f5f5f face="sans-serif">Cc:
</font><font size=1 face="sans-serif">Weld <weld-dev@lists.jboss.org></font><br><font size=1 color=#5f5f5f face="sans-serif">Date:
</font><font size=1 face="sans-serif">18/11/2015 15:52</font><br><font size=1 color=#5f5f5f face="sans-serif">Subject:
</font><font size=1 face="sans-serif">Re: potential
weld jira</font><br><hr noshade><br><br><br><tt><font size=2>Well, it seems the problem is that CounterProducerModified
is <br>specialized by AlternativeCounterProducerModified and so it's not <br>enabled and therefore it's producer method is also disabled (see also <br>5.1.2. Enabled and disabled beans [1]), i.e. it's not available for <br>injection in beans-xml-modified2.jar. And <br>AlternativeCounterProducerModified is an alternative which is not <br>selected for beans-xml-modified2.jar.<br><br>It should work if you enable AlternativeCounterProducerModified globally
<br>or select AlternativeCounterProducerModified for beans-xml-modified2.jar.<br><br>Martin<br><br>[1]<br></font></tt><a href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#enablement"><tt><font size=2>http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#enablement</font></tt></a><tt><font size=2><br><br>Dne 18.11.2015 v 16:14 Emily Jiang napsal(a):<br>> Hi Martin,<br>><br>> Here's a simplified form of the test case:<br>><br>><br>> The application does not start, reporting<br>><br>> [ERROR ] CWWKZ0004E: An exception occurred while starting the<br>> application testDiffBDA. The exception message was:<br>> com.ibm.ws.container.service.state.StateChangeException:<br>> org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied<br>> dependencies for type String with qualifiers @CounterModifiedQualifier<br>> at injection point [BackedAnnotatedField] @Inject<br>> @CounterModifiedQualifier<br>> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified2.modifiedProducer<br>> at<br>> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified2.modifiedProducer(CounterProducerConsumerModified2.java:0)<br>><br>> There are five classes in the .war.<br>><br>> testDiffBDA.war/WEB-INF/classes/test/diff/web/FrontEndServlet.class<br>><br>> @Inject CounterProducerConsumerModified2 bean;<br>><br>> This class, CounterProducerConsumerModified2.class is packaged in
the<br>> first of two WEB-INF/lib jars, at<br>> testDiffBDA.war/WEB-INF/lib/beans-xml-modified2.jar.jar/com/ibm/jcdi/test/beans/xml.<br>> There is a bean that needs another bean injected into it:<br>><br>> @Inject@CounterModifiedQualifierString modifiedProducer;<br>><br>> The remaining three classes are all in the second WEB-INF/lib jar,
at<br>> testDiffBDA.war/WEB-INF/lib/beans-xml-modified.jar.jar/com/ibm/jcdi/test/beansxml/.<br>> The classes are<br>><br>> CounterModifiedQualifier (the interface)<br>> CounterProducerModified (the bean implementing that interface)<br>> AlternativeCounterProducerModified (an alternative bean)<br>><br>> The AlternativeCounterProducerModified class is declared in<br>> testDiffBDA.war/WEB-INF/lib/beans-xml-modified.jar.jar/META-INF/beans.xml,<br>><br>> <alternatives><br>> <class>com.ibm.jcdi.test.beansxml.AlternativeCounterProducerModified</class><br>> </alternatives><br>><br>> The test app starts correctly if the <alternative> stanza is
commented out.<br>><br>><br>> Many thanks,<br>> Emily<br>> ===========================<br>> Emily Jiang<br>> WebSphere Application Server, CDI Development Lead<br>><br>> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>> Phone: +44 (0)1962 816278 Internal: 246278<br>><br>> Email: emijiang@uk.ibm.com<br>> Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>><br>><br>><br>><br>> From: Martin Kouba <mkouba@redhat.com><br>> To: Emily Jiang/UK/IBM@IBMGB, Weld <weld-dev@lists.jboss.org>,<br>> Date: 18/11/2015 07:58<br>> Subject: Re: potential weld jira<br>> ------------------------------------------------------------------------<br>><br>><br>><br>> Hi Emily,<br>><br>> a brief description would be helpful - it's not a trivial<br>> deployment/reproducer.<br>><br>> Martin<br>><br>> Dne 16.11.2015 v 23:15 Emily Jiang napsal(a):<br>> > I'm trying to deploy the attached war but got Weld alidation
error. On<br>> > Glassfish 4.1, I got this error:<br>> > Error occurred during deployment: Exception while loading
the app : CDI<br>> > deployment failure:WELD-001408: Unsatisfied dependencies
for type String<br>> > with qualifiers @DiffBDACounterQualifier at injection point<br>> > [BackedAnnotatedField] @Inject @DiffBDACounterQualifier<br>> ><br>> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified.diffBDAProducer<br>> > at<br>> ><br>> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified.diffBDAProducer(CounterProducerConsumerModified.java:0)<br>> > WELD-001475: The following beans match by type, but none
have matching<br>> > qualifiers: - Producer Method [String] with qualifiers<br>> > [@CounterUnmodifiedQualifier @Any] declared as [[BackedAnnotatedMethod]<br>> > @ExcludeClassInterceptors @Produces @CounterUnmodifiedQualifier<br>> ><br>> com.ibm.jcdi.test.beansxml.CounterProducerNoModifiers.getCounterBeanProducer()],<br>> > - Producer Method [String] with qualifiers [@BatchProperty
@Any]<br>> > declared as [[UnbackedAnnotatedMethod] @Produces @Dependent<br>> > @BatchProperty public com.ibm.jbatch.container.cdi.BatchProducerBean.p<br>> > .... msg.seeServerLog<br>> ><br>> ><br>> ><br>> ><br>> ><br>> > The app works fine on OpenWebBeans. Any ideas on what was
wrong?<br>> ><br>> > Many thanks,<br>> > Emily<br>> > ===========================<br>> > Emily Jiang<br>> > WebSphere Application Server, CDI Development Lead<br>> ><br>> > MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>> > Phone: +44 (0)1962 816278 Internal: 246278<br>> ><br>> > Email: emijiang@uk.ibm.com<br>> > Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>> ><br>><br>> --<br>> Martin Kouba<br>> Software Engineer<br>> Red Hat, Czech Republic<br>><br>><br>><br><br>-- <br>Martin Kouba<br>Software Engineer<br>Red Hat, Czech Republic<br><br></font></tt><br><BR>