<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">&nbsp;In the above app, there are two
jars. The jar beans-xml-modified2.jar.jar &nbsp;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">&nbsp;<br>MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>Phone: &nbsp;+44 (0)1962 816278 &nbsp;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: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Martin Kouba &lt;mkouba@redhat.com&gt;</font><br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Emily Jiang/UK/IBM@IBMGB,
</font><br><font size=1 color=#5f5f5f face="sans-serif">Cc: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Weld &lt;weld-dev@lists.jboss.org&gt;</font><br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">18/11/2015 15:52</font><br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</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>&gt; Hi Martin,<br>&gt;<br>&gt; Here's a simplified form of the test case:<br>&gt;<br>&gt;<br>&gt; The application does not start, reporting<br>&gt;<br>&gt; [ERROR &nbsp; ] CWWKZ0004E: An exception occurred while starting the<br>&gt; application testDiffBDA. The exception message was:<br>&gt; com.ibm.ws.container.service.state.StateChangeException:<br>&gt; org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied<br>&gt; dependencies for type String with qualifiers @CounterModifiedQualifier<br>&gt; &nbsp; &nbsp;at injection point [BackedAnnotatedField] @Inject<br>&gt; @CounterModifiedQualifier<br>&gt; com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified2.modifiedProducer<br>&gt; &nbsp; &nbsp;at<br>&gt; com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified2.modifiedProducer(CounterProducerConsumerModified2.java:0)<br>&gt;<br>&gt; There are five classes in the .war.<br>&gt;<br>&gt; testDiffBDA.war/WEB-INF/classes/test/diff/web/FrontEndServlet.class<br>&gt;<br>&gt; @Inject CounterProducerConsumerModified2 bean;<br>&gt;<br>&gt; This class, CounterProducerConsumerModified2.class is packaged in
the<br>&gt; first of two WEB-INF/lib jars, at<br>&gt; testDiffBDA.war/WEB-INF/lib/beans-xml-modified2.jar.jar/com/ibm/jcdi/test/beans/xml.<br>&gt; There is a bean that needs another bean injected into it:<br>&gt;<br>&gt; @Inject@CounterModifiedQualifierString modifiedProducer;<br>&gt;<br>&gt; The remaining three classes are all in the second WEB-INF/lib jar,
at<br>&gt; testDiffBDA.war/WEB-INF/lib/beans-xml-modified.jar.jar/com/ibm/jcdi/test/beansxml/.<br>&gt; The classes are<br>&gt;<br>&gt; CounterModifiedQualifier &nbsp;(the interface)<br>&gt; CounterProducerModified (the bean implementing that interface)<br>&gt; AlternativeCounterProducerModified (an alternative bean)<br>&gt;<br>&gt; The AlternativeCounterProducerModified class is declared in<br>&gt; testDiffBDA.war/WEB-INF/lib/beans-xml-modified.jar.jar/META-INF/beans.xml,<br>&gt;<br>&gt; &lt;alternatives&gt;<br>&gt; &lt;class&gt;com.ibm.jcdi.test.beansxml.AlternativeCounterProducerModified&lt;/class&gt;<br>&gt; &lt;/alternatives&gt;<br>&gt;<br>&gt; The test app starts correctly if the &lt;alternative&gt; stanza is
commented out.<br>&gt;<br>&gt;<br>&gt; Many thanks,<br>&gt; Emily<br>&gt; ===========================<br>&gt; Emily Jiang<br>&gt; WebSphere Application Server, CDI Development Lead<br>&gt;<br>&gt; MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>&gt; Phone: &nbsp;+44 (0)1962 816278 &nbsp;Internal: 246278<br>&gt;<br>&gt; Email: emijiang@uk.ibm.com<br>&gt; Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt; From: Martin Kouba &lt;mkouba@redhat.com&gt;<br>&gt; To: Emily Jiang/UK/IBM@IBMGB, Weld &lt;weld-dev@lists.jboss.org&gt;,<br>&gt; Date: 18/11/2015 07:58<br>&gt; Subject: Re: potential weld jira<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>&gt;<br>&gt;<br>&gt; Hi Emily,<br>&gt;<br>&gt; a brief description would be helpful - it's not a trivial<br>&gt; deployment/reproducer.<br>&gt;<br>&gt; Martin<br>&gt;<br>&gt; Dne 16.11.2015 v 23:15 Emily Jiang napsal(a):<br>&gt; &nbsp;&gt; I'm trying to deploy the attached war but got Weld alidation
error. On<br>&gt; &nbsp;&gt; Glassfish 4.1, I got this error:<br>&gt; &nbsp;&gt; Error occurred during deployment: Exception while loading
the app : CDI<br>&gt; &nbsp;&gt; deployment failure:WELD-001408: Unsatisfied dependencies
for type String<br>&gt; &nbsp;&gt; with qualifiers @DiffBDACounterQualifier at injection point<br>&gt; &nbsp;&gt; [BackedAnnotatedField] @Inject @DiffBDACounterQualifier<br>&gt; &nbsp;&gt;<br>&gt; com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified.diffBDAProducer<br>&gt; &nbsp;&gt; at<br>&gt; &nbsp;&gt;<br>&gt; com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified.diffBDAProducer(CounterProducerConsumerModified.java:0)<br>&gt; &nbsp;&gt; WELD-001475: The following beans match by type, but none
have matching<br>&gt; &nbsp;&gt; qualifiers: - Producer Method [String] with qualifiers<br>&gt; &nbsp;&gt; [@CounterUnmodifiedQualifier @Any] declared as [[BackedAnnotatedMethod]<br>&gt; &nbsp;&gt; @ExcludeClassInterceptors @Produces @CounterUnmodifiedQualifier<br>&gt; &nbsp;&gt;<br>&gt; com.ibm.jcdi.test.beansxml.CounterProducerNoModifiers.getCounterBeanProducer()],<br>&gt; &nbsp;&gt; - Producer Method [String] with qualifiers [@BatchProperty
@Any]<br>&gt; &nbsp;&gt; declared as [[UnbackedAnnotatedMethod] @Produces @Dependent<br>&gt; &nbsp;&gt; @BatchProperty public com.ibm.jbatch.container.cdi.BatchProducerBean.p<br>&gt; &nbsp;&gt; .... msg.seeServerLog<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; The app works fine on OpenWebBeans. Any ideas on what was
wrong?<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; Many thanks,<br>&gt; &nbsp;&gt; Emily<br>&gt; &nbsp;&gt; ===========================<br>&gt; &nbsp;&gt; Emily Jiang<br>&gt; &nbsp;&gt; WebSphere Application Server, CDI Development Lead<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>&gt; &nbsp;&gt; Phone: &nbsp;+44 (0)1962 816278 &nbsp;Internal: 246278<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; Email: emijiang@uk.ibm.com<br>&gt; &nbsp;&gt; Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>&gt; &nbsp;&gt;<br>&gt;<br>&gt; --<br>&gt; Martin Kouba<br>&gt; Software Engineer<br>&gt; Red Hat, Czech Republic<br>&gt;<br>&gt;<br>&gt;<br><br>-- <br>Martin Kouba<br>Software Engineer<br>Red Hat, Czech Republic<br><br></font></tt><br><BR>