<font size=2 face="sans-serif">I found this in the spec:</font><br><br><br><font size=3>Hi Martin, </font><br><font size=3>I found this:</font><br><br><font size=3>In 4.3 Specialization, <br>@Alternative @Specializes<br>public class MockAsynchronousService extends AsynchronousService {<br>...<br>}<br><b>When an enabled bean</b>, as defined in Section 5.1.2, “Enabled and
disabled beans”, specializes<br>a second bean, we can be certain that the second bean is never instantiated
or called by the<br>container. </font><br><br><font size=2 face="sans-serif">If the alternative bean is not enabled,
it should not specialise/disable another bean. Do you agree with me or
you still want me to raise a question in cdi-dev?</font><br><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">19/11/2015 09:11</font><br><font size=1 color=#5f5f5f face="sans-serif">Subject:
</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:
</font><font size=1 face="sans-serif">weld-dev-bounces@lists.jboss.org</font><br><hr noshade><br><br><br><tt><font size=2>Dne 19.11.2015 v 10:07 Emily Jiang napsal(a):<br>> Hi Martin,<br>><br>> The issue is that the specialized bean is not enabled for<br>> beans-xml-modified2.jar.<br><br>Yep, but the spec does not state this should be taken into account.<br><br>> @Alternative @Specialized annotated beans should not be active if
it is<br>> not enabled. I think the specialized should not be active if the<br>> alternative is not. Otherwise, we run into the situation where the<br>> specialized bean disabled a second bean but itself is not active.<br>><br>> ok. I'll post the question on cdi-dev.<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,<br>> Cc: Weld <weld-dev@lists.jboss.org><br>> Date: 19/11/2015 07:46<br>> Subject: Re: [weld-dev] potential weld jira<br>> Sent by: weld-dev-bounces@lists.jboss.org<br>> ------------------------------------------------------------------------<br>><br>><br>><br>> The enablement is per bean archive but specialization is not, see
also<br>> 4.3. Specialization:<br>><br>> "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."<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>> > Thank you Martin!<br>> ><br>> > I interpreted this enablement differently.<br>> ><br>> > The CDI 1.2 spec states:<br>> ><br>> > A bean is said to be /enabled/ if:<br>> ><br>> > * it is deployed in a bean archive, and<br>> > * it is not a producer method or field of a disabled
bean, and<br>> > * it is not specialized by any other enabled bean,
as defined in<br>> > _Specialization_<br>> > <</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>>,<br>> > and either<br>> > * it is not an alternative, or it is a selected
alternative of at<br>> > least one bean archive or the application.<br>> ><br>> > Otherwise, the bean is said to be disabled.<br>> ><br>> > In the above app, there are two jars. The jar<br>> > beans-xml-modified2.jar.jar does not enable the alternative
and in its<br>> > injection, it should only see the CounterProducerModified.
While in<br>> > another jar, the alternative AlternativeCounterProducerModified<br>> > completely disabled the CounterProducerModified. Any injection
in that<br>> > jar should only see the specialized bean.<br>> ><br>> > From what you explained, the beans.xml in one jar
enabled the<br>> > alternative bean and affect other jars. From my understanding,
the<br>> > enablement of alternatives/interceptors are specific for
that archive<br>> > and should not affect other jars.<br>> ><br>> > Also OpenWebBeans behaves differently from Weld, and OpenWebBeans
does<br>> > what I have expected (enablement are per jar only).<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,<br>> > Cc: Weld <weld-dev@lists.jboss.org><br>> > Date: 18/11/2015 15:52<br>> > Subject: Re: potential weld jira<br>> ><br>> > ------------------------------------------------------------------------<br>> ><br>> ><br>> ><br>> > 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:<br>> Unsatisfied<br>> > > dependencies for type String with qualifiers
@CounterModifiedQualifier<br>> > > at injection point [BackedAnnotatedField]
@Inject<br>> > > @CounterModifiedQualifier<br>> > ><br>> ><br>> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified2.modifiedProducer<br>> > > at<br>> > ><br>> ><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>> > ><br>> ><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>> > ><br>> ><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>> > ><br>> ><br>> testDiffBDA.war/WEB-INF/lib/beans-xml-modified.jar.jar/META-INF/beans.xml,<br>> > ><br>> > > <alternatives><br>> > ><br>> ><br>> <class>com.ibm.jcdi.test.beansxml.AlternativeCounterProducerModified</class><br>> > > </alternatives><br>> > ><br>> > > The test app starts correctly if the <alternative>
stanza is<br>> > 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>> > ><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<br>> error. On<br>> > > > Glassfish 4.1, I got this error:<br>> > > > Error occurred during deployment:
Exception while loading the app<br>> > : CDI<br>> > > > deployment failure:WELD-001408: Unsatisfied
dependencies for type<br>> > String<br>> > > > with qualifiers @DiffBDACounterQualifier
at injection point<br>> > > > [BackedAnnotatedField] @Inject @DiffBDACounterQualifier<br>> > > ><br>> > ><br>> ><br>> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified.diffBDAProducer<br>> > > > at<br>> > > ><br>> > ><br>> ><br>> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified.diffBDAProducer(CounterProducerConsumerModified.java:0)<br>> > > > WELD-001475: The following beans
match by type, but none have<br>> matching<br>> > > > qualifiers: - Producer Method [String]
with qualifiers<br>> > > > [@CounterUnmodifiedQualifier @Any]
declared as<br>> > [[BackedAnnotatedMethod]<br>> > > > @ExcludeClassInterceptors @Produces
@CounterUnmodifiedQualifier<br>> > > ><br>> > ><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<br>> 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>> ><br>> ><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>><br>> Unless stated otherwise above:<br>> IBM United Kingdom Limited - Registered in England and Wales with
number<br>> 741598.<br>> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6 3AU<br>><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>