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