Re: [weld-dev] potential weld jira

2015-11-19 Thread Emily Jiang
I found this in the spec:


Hi Martin, 
I found this:

In 4.3 Specialization, 
@Alternative @Specializes
public class MockAsynchronousService extends AsynchronousService {
...
}
When an enabled bean, as defined in Section 5.1.2, “Enabled and disabled 
beans”, specializes
a second bean, we can be certain that the second bean is never 
instantiated or called by the
container. 

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?


Many thanks,
Emily
===
Emily Jiang
WebSphere Application Server, CDI Development Lead
 
MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
Phone:  +44 (0)1962 816278  Internal: 246278

Email: emiji...@uk.ibm.com 
Lotus Notes: Emily Jiang/UK/IBM@IBMGB




From:   Martin Kouba <mko...@redhat.com>
To: Emily Jiang/UK/IBM@IBMGB, 
Cc: Weld <weld-dev@lists.jboss.org>
Date:   19/11/2015 09:11
Subject:    Re: [weld-dev] potential weld jira
Sent by:weld-dev-boun...@lists.jboss.org



Dne 19.11.2015 v 10:07 Emily Jiang napsal(a):
> Hi Martin,
>
> The issue is that the specialized bean is not enabled for
> beans-xml-modified2.jar.

Yep, but the spec does not state this should be taken into account.

> @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.
>
> ok. I'll post the question on cdi-dev.
>
> Many thanks,
> Emily
> ===
> Emily Jiang
> WebSphere Application Server, CDI Development Lead
>
> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
> Phone:  +44 (0)1962 816278  Internal: 246278
>
> Email: emiji...@uk.ibm.com
> Lotus Notes: Emily Jiang/UK/IBM@IBMGB
>
>
>
>
> From: Martin Kouba <mko...@redhat.com>
> To: Emily Jiang/UK/IBM@IBMGB,
> Cc: Weld <weld-dev@lists.jboss.org>
> Date: 19/11/2015 07:46
> Subject: Re: [weld-dev] potential weld jira
> Sent by: weld-dev-boun...@lists.jboss.org
> 
>
>
>
> The enablement is per bean archive but specialization is not, see also
> 4.3. Specialization:
>
> "When an enabled bean, as defined in Enabled and disabled beans,
> specializes a second bean, we can be certain that the second bean is
> never instantiated or called by the container. Even if the second bean
> defines a producer or observer method, the method will never be called."
>
> In other words, AlternativeCounterProducerModified (which is enabled in
> beans-xml-modified.jar) specializes CounterProducerModified. And so
> CounterProducerModified is not enabled for beans-xml-modified2.jar
> because it is specialized by any other enabled bean.
>
> Feel free to post a question to the cdi-dev ML.
>
> Martin
>
> Dne 18.11.2015 v 18:14 Emily Jiang napsal(a):
>  > Thank you Martin!
>  >
>  > I interpreted this enablement differently.
>  >
>  > The CDI 1.2 spec states:
>  >
>  > A bean is said to be /enabled/ if:
>  >
>  >   * it is deployed in a bean archive, and
>  >   * it is not a producer method or field of a disabled bean, and
>  >   * it is not specialized by any other enabled bean, as defined in
>  > _Specialization_
>  > <http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#specialization
>,
>  > and either
>  >   * it is not an alternative, or it is a selected alternative of at
>  > least one bean archive or the application.
>  >
>  > Otherwise, the bean is said to be disabled.
>  >
>  >   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.
>  >
>  >  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.
>  >
>  > Also OpenWebBeans behaves differently from Weld, and OpenWebBeans 
does
>  > what I have expected (enablement are per jar only).
>  >
>  > Many thanks,
>  > Emily
>  > ===
>  > Emily Jiang
>  > WebSphere Applica

Re: [weld-dev] potential weld jira

2015-11-19 Thread Emily Jiang
Hi Martin,

The issue is that the specialized bean is not enabled for 
beans-xml-modified2.jar. 
@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. 

ok. I'll post the question on cdi-dev.

Many thanks,
Emily
===
Emily Jiang
WebSphere Application Server, CDI Development Lead
 
MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
Phone:  +44 (0)1962 816278  Internal: 246278

Email: emiji...@uk.ibm.com 
Lotus Notes: Emily Jiang/UK/IBM@IBMGB




From:   Martin Kouba <mko...@redhat.com>
To: Emily Jiang/UK/IBM@IBMGB, 
Cc: Weld <weld-dev@lists.jboss.org>
Date:   19/11/2015 07:46
Subject:    Re: [weld-dev] potential weld jira
Sent by:weld-dev-boun...@lists.jboss.org



The enablement is per bean archive but specialization is not, see also 
4.3. Specialization:

"When an enabled bean, as defined in Enabled and disabled beans, 
specializes a second bean, we can be certain that the second bean is 
never instantiated or called by the container. Even if the second bean 
defines a producer or observer method, the method will never be called."

In other words, AlternativeCounterProducerModified (which is enabled in 
beans-xml-modified.jar) specializes CounterProducerModified. And so 
CounterProducerModified is not enabled for beans-xml-modified2.jar 
because it is specialized by any other enabled bean.

Feel free to post a question to the cdi-dev ML.

Martin

Dne 18.11.2015 v 18:14 Emily Jiang napsal(a):
> Thank you Martin!
>
> I interpreted this enablement differently.
>
> The CDI 1.2 spec states:
>
> A bean is said to be /enabled/ if:
>
>   * it is deployed in a bean archive, and
>   * it is not a producer method or field of a disabled bean, and
>   * it is not specialized by any other enabled bean, as defined in
> _Specialization_
> <http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#specialization>,
> and either
>   * it is not an alternative, or it is a selected alternative of at
> least one bean archive or the application.
>
> Otherwise, the bean is said to be disabled.
>
>   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.
>
>  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.
>
> Also OpenWebBeans behaves differently from Weld, and OpenWebBeans does
> what I have expected (enablement are per jar only).
>
> Many thanks,
> Emily
> ===
> Emily Jiang
> WebSphere Application Server, CDI Development Lead
>
> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
> Phone:  +44 (0)1962 816278  Internal: 246278
>
> Email: emiji...@uk.ibm.com
> Lotus Notes: Emily Jiang/UK/IBM@IBMGB
>
>
>
>
> From: Martin Kouba <mko...@redhat.com>
> To: Emily Jiang/UK/IBM@IBMGB,
> Cc: Weld <weld-dev@lists.jboss.org>
> Date: 18/11/2015 15:52
> Subject: Re: potential weld jira
>
> 
>
>
>
> Well, it seems the problem is that CounterProducerModified is
> specialized by AlternativeCounterProducerModified and so it's not
> enabled and therefore it's producer method is also disabled (see also
> 5.1.2. Enabled and disabled beans [1]), i.e. it's not available for
> injection in beans-xml-modified2.jar. And
> AlternativeCounterProducerModified is an alternative which is not
> selected for beans-xml-modified2.jar.
>
> It should work if you enable AlternativeCounterProducerModified globally
> or select AlternativeCounterProducerModified for 
beans-xml-modified2.jar.
>
> Martin
>
> [1]
> http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#enablement
>
> Dne 18.11.2015 v 16:14 Emily Jiang napsal(a):
>  > Hi Martin,
>  >
>  > Here's a simplified form of the test case:
>  >
>  >
>  > The application does not start, reporting
>  >
>  > [ERROR   ] CWWKZ0004E: An exception occurred while starting the
>  > application testDiffBDA. The exception message was:
>  > com.ibm.ws.container.service.state.StateChangeException:

Re: [weld-dev] potential weld jira

2015-11-19 Thread Martin Kouba
Dne 19.11.2015 v 10:07 Emily Jiang napsal(a):
> Hi Martin,
>
> The issue is that the specialized bean is not enabled for
> beans-xml-modified2.jar.

Yep, but the spec does not state this should be taken into account.

> @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.
>
> ok. I'll post the question on cdi-dev.
>
> Many thanks,
> Emily
> ===
> Emily Jiang
> WebSphere Application Server, CDI Development Lead
>
> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
> Phone:  +44 (0)1962 816278  Internal: 246278
>
> Email: emiji...@uk.ibm.com
> Lotus Notes: Emily Jiang/UK/IBM@IBMGB
>
>
>
>
> From: Martin Kouba <mko...@redhat.com>
> To: Emily Jiang/UK/IBM@IBMGB,
> Cc: Weld <weld-dev@lists.jboss.org>
> Date: 19/11/2015 07:46
> Subject: Re: [weld-dev] potential weld jira
> Sent by: weld-dev-boun...@lists.jboss.org
> 
>
>
>
> The enablement is per bean archive but specialization is not, see also
> 4.3. Specialization:
>
> "When an enabled bean, as defined in Enabled and disabled beans,
> specializes a second bean, we can be certain that the second bean is
> never instantiated or called by the container. Even if the second bean
> defines a producer or observer method, the method will never be called."
>
> In other words, AlternativeCounterProducerModified (which is enabled in
> beans-xml-modified.jar) specializes CounterProducerModified. And so
> CounterProducerModified is not enabled for beans-xml-modified2.jar
> because it is specialized by any other enabled bean.
>
> Feel free to post a question to the cdi-dev ML.
>
> Martin
>
> Dne 18.11.2015 v 18:14 Emily Jiang napsal(a):
>  > Thank you Martin!
>  >
>  > I interpreted this enablement differently.
>  >
>  > The CDI 1.2 spec states:
>  >
>  > A bean is said to be /enabled/ if:
>  >
>  >   * it is deployed in a bean archive, and
>  >   * it is not a producer method or field of a disabled bean, and
>  >   * it is not specialized by any other enabled bean, as defined in
>  > _Specialization_
>  > <http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#specialization>,
>  > and either
>  >   * it is not an alternative, or it is a selected alternative of at
>  > least one bean archive or the application.
>  >
>  > Otherwise, the bean is said to be disabled.
>  >
>  >   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.
>  >
>  >  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.
>  >
>  > Also OpenWebBeans behaves differently from Weld, and OpenWebBeans does
>  > what I have expected (enablement are per jar only).
>  >
>  > Many thanks,
>  > Emily
>  > ===
>  > Emily Jiang
>  > WebSphere Application Server, CDI Development Lead
>  >
>  > MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
>  > Phone:  +44 (0)1962 816278  Internal: 246278
>  >
>  > Email: emiji...@uk.ibm.com
>  > Lotus Notes: Emily Jiang/UK/IBM@IBMGB
>  >
>  >
>  >
>  >
>  > From: Martin Kouba <mko...@redhat.com>
>  > To: Emily Jiang/UK/IBM@IBMGB,
>  > Cc: Weld <weld-dev@lists.jboss.org>
>  > Date: 18/11/2015 15:52
>  > Subject: Re: potential weld jira
>  >
>  > 
>  >
>  >
>  >
>  > Well, it seems the problem is that CounterProducerModified is
>  > specialized by AlternativeCounterProducerModified and so it's not
>  > enabled and therefore it's producer method is also disabled (see also
>  > 5.1.2. Enabled and disabled beans [1]), i.e. it's not available for
>  > injection in beans-xml-modified2.jar. And
>  > AlternativeCounterProducerModified is an alternati

Re: [weld-dev] potential weld jira

2015-11-18 Thread Emily Jiang
Thank you Martin!

I interpreted this enablement differently.

The CDI 1.2 spec states:

A bean is said to be enabled if:
it is deployed in a bean archive, and
it is not a producer method or field of a disabled bean, and
it is not specialized by any other enabled bean, as defined in 
Specialization, and either
it is not an alternative, or it is a selected alternative of at least one 
bean archive or the application.
Otherwise, the bean is said to be disabled.

 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.
>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. 
Also OpenWebBeans behaves differently from Weld, and OpenWebBeans does 
what I have expected (enablement are per jar only).

Many thanks,
Emily
===
Emily Jiang
WebSphere Application Server, CDI Development Lead
 
MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
Phone:  +44 (0)1962 816278  Internal: 246278

Email: emiji...@uk.ibm.com 
Lotus Notes: Emily Jiang/UK/IBM@IBMGB




From:   Martin Kouba 
To: Emily Jiang/UK/IBM@IBMGB, 
Cc: Weld 
Date:   18/11/2015 15:52
Subject:Re: potential weld jira



Well, it seems the problem is that CounterProducerModified is 
specialized by AlternativeCounterProducerModified and so it's not 
enabled and therefore it's producer method is also disabled (see also 
5.1.2. Enabled and disabled beans [1]), i.e. it's not available for 
injection in beans-xml-modified2.jar. And 
AlternativeCounterProducerModified is an alternative which is not 
selected for beans-xml-modified2.jar.

It should work if you enable AlternativeCounterProducerModified globally 
or select AlternativeCounterProducerModified for beans-xml-modified2.jar.

Martin

[1]
http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#enablement

Dne 18.11.2015 v 16:14 Emily Jiang napsal(a):
> Hi Martin,
>
> Here's a simplified form of the test case:
>
>
> The application does not start, reporting
>
> [ERROR   ] CWWKZ0004E: An exception occurred while starting the
> application testDiffBDA. The exception message was:
> com.ibm.ws.container.service.state.StateChangeException:
> org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied
> dependencies for type String with qualifiers @CounterModifiedQualifier
>at injection point [BackedAnnotatedField] @Inject
> @CounterModifiedQualifier
> 
com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified2.modifiedProducer
>at
> 
com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified2.modifiedProducer(CounterProducerConsumerModified2.java:0)
>
> There are five classes in the .war.
>
> testDiffBDA.war/WEB-INF/classes/test/diff/web/FrontEndServlet.class
>
> @Inject CounterProducerConsumerModified2 bean;
>
> This class, CounterProducerConsumerModified2.class is packaged in the
> first of two WEB-INF/lib jars, at
> 
testDiffBDA.war/WEB-INF/lib/beans-xml-modified2.jar.jar/com/ibm/jcdi/test/beans/xml.
> There is a bean that needs another bean injected into it:
>
> @Inject@CounterModifiedQualifierString modifiedProducer;
>
> The remaining three classes are all in the second WEB-INF/lib jar, at
> 
testDiffBDA.war/WEB-INF/lib/beans-xml-modified.jar.jar/com/ibm/jcdi/test/beansxml/.
> The classes are
>
> CounterModifiedQualifier  (the interface)
> CounterProducerModified (the bean implementing that interface)
> AlternativeCounterProducerModified (an alternative bean)
>
> The AlternativeCounterProducerModified class is declared in
> 
testDiffBDA.war/WEB-INF/lib/beans-xml-modified.jar.jar/META-INF/beans.xml,
>
> 
> 
com.ibm.jcdi.test.beansxml.AlternativeCounterProducerModified
> 
>
> The test app starts correctly if the  stanza is commented 
out.
>
>
> Many thanks,
> Emily
> ===
> Emily Jiang
> WebSphere Application Server, CDI Development Lead
>
> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
> Phone:  +44 (0)1962 816278  Internal: 246278
>
> Email: emiji...@uk.ibm.com
> Lotus Notes: Emily Jiang/UK/IBM@IBMGB
>
>
>
>
> From: Martin Kouba 
> To: Emily Jiang/UK/IBM@IBMGB, Weld ,
> Date: 18/11/2015 07:58
> Subject: Re: potential weld jira
> 
>
>
>
> Hi Emily,
>
> a brief description would be helpful - it's not a trivial
> deployment/reproducer.
>
> Martin
>
> Dne 16.11.2015 v 23:15 Emily Jiang napsal(a):
>  > I'm trying to deploy the attached war but got Weld alidation error. 
On
>  > 

Re: [weld-dev] potential weld jira

2015-11-18 Thread Martin Kouba
Well, it seems the problem is that CounterProducerModified is 
specialized by AlternativeCounterProducerModified and so it's not 
enabled and therefore it's producer method is also disabled (see also 
5.1.2. Enabled and disabled beans [1]), i.e. it's not available for 
injection in beans-xml-modified2.jar. And 
AlternativeCounterProducerModified is an alternative which is not 
selected for beans-xml-modified2.jar.

It should work if you enable AlternativeCounterProducerModified globally 
or select AlternativeCounterProducerModified for beans-xml-modified2.jar.

Martin

[1]
http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#enablement

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

-- 
Martin Kouba
Software 

Re: [weld-dev] potential weld jira

2015-11-18 Thread Martin Kouba
The enablement is per bean archive but specialization is not, see also 
4.3. Specialization:

"When an enabled bean, as defined in Enabled and disabled beans, 
specializes a second bean, we can be certain that the second bean is 
never instantiated or called by the container. Even if the second bean 
defines a producer or observer method, the method will never be called."

In other words, AlternativeCounterProducerModified (which is enabled in 
beans-xml-modified.jar) specializes CounterProducerModified. And so 
CounterProducerModified is not enabled for beans-xml-modified2.jar 
because it is specialized by any other enabled bean.

Feel free to post a question to the cdi-dev ML.

Martin

Dne 18.11.2015 v 18:14 Emily Jiang napsal(a):
> Thank you Martin!
>
> I interpreted this enablement differently.
>
> The CDI 1.2 spec states:
>
> A bean is said to be /enabled/ if:
>
>   * it is deployed in a bean archive, and
>   * it is not a producer method or field of a disabled bean, and
>   * it is not specialized by any other enabled bean, as defined in
> _Specialization_
> ,
> and either
>   * it is not an alternative, or it is a selected alternative of at
> least one bean archive or the application.
>
> Otherwise, the bean is said to be disabled.
>
>   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.
>
>  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.
>
> Also OpenWebBeans behaves differently from Weld, and OpenWebBeans does
> what I have expected (enablement are per jar only).
>
> Many thanks,
> Emily
> ===
> Emily Jiang
> WebSphere Application Server, CDI Development Lead
>
> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
> Phone:  +44 (0)1962 816278  Internal: 246278
>
> Email: emiji...@uk.ibm.com
> Lotus Notes: Emily Jiang/UK/IBM@IBMGB
>
>
>
>
> From: Martin Kouba 
> To: Emily Jiang/UK/IBM@IBMGB,
> Cc: Weld 
> Date: 18/11/2015 15:52
> Subject: Re: potential weld jira
>
> 
>
>
>
> Well, it seems the problem is that CounterProducerModified is
> specialized by AlternativeCounterProducerModified and so it's not
> enabled and therefore it's producer method is also disabled (see also
> 5.1.2. Enabled and disabled beans [1]), i.e. it's not available for
> injection in beans-xml-modified2.jar. And
> AlternativeCounterProducerModified is an alternative which is not
> selected for beans-xml-modified2.jar.
>
> It should work if you enable AlternativeCounterProducerModified globally
> or select AlternativeCounterProducerModified for beans-xml-modified2.jar.
>
> Martin
>
> [1]
> http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#enablement
>
> Dne 18.11.2015 v 16:14 Emily Jiang napsal(a):
>  > Hi Martin,
>  >
>  > Here's a simplified form of the test case:
>  >
>  >
>  > The application does not start, reporting
>  >
>  > [ERROR   ] CWWKZ0004E: An exception occurred while starting the
>  > application testDiffBDA. The exception message was:
>  > com.ibm.ws.container.service.state.StateChangeException:
>  > org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied
>  > dependencies for type String with qualifiers @CounterModifiedQualifier
>  >at injection point [BackedAnnotatedField] @Inject
>  > @CounterModifiedQualifier
>  >
> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified2.modifiedProducer
>  >at
>  >
> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified2.modifiedProducer(CounterProducerConsumerModified2.java:0)
>  >
>  > There are five classes in the .war.
>  >
>  > testDiffBDA.war/WEB-INF/classes/test/diff/web/FrontEndServlet.class
>  >
>  > @Inject CounterProducerConsumerModified2 bean;
>  >
>  > This class, CounterProducerConsumerModified2.class is packaged in the
>  > first of two WEB-INF/lib jars, at
>  >
> testDiffBDA.war/WEB-INF/lib/beans-xml-modified2.jar.jar/com/ibm/jcdi/test/beans/xml.
>  > There is a bean that needs another bean injected into it:
>  >
>  > @Inject@CounterModifiedQualifierString modifiedProducer;
>  >
>  > The remaining three classes are all in the second WEB-INF/lib jar, at
>  >
> testDiffBDA.war/WEB-INF/lib/beans-xml-modified.jar.jar/com/ibm/jcdi/test/beansxml/.
>  > The classes are
>  >
>  > CounterModifiedQualifier  (the interface)
>  > CounterProducerModified (the bean implementing that interface)
>  > 

Re: [weld-dev] potential weld jira

2015-11-17 Thread Martin Kouba
Hi Emily,

a brief description would be helpful - it's not a trivial 
deployment/reproducer.

Martin

Dne 16.11.2015 v 23:15 Emily Jiang napsal(a):
> I'm trying to deploy the attached war but got Weld alidation error. On
> Glassfish 4.1, I got this error:
> Error occurred during deployment: Exception while loading the app : CDI
> deployment failure:WELD-001408: Unsatisfied dependencies for type String
> with qualifiers @DiffBDACounterQualifier at injection point
> [BackedAnnotatedField] @Inject @DiffBDACounterQualifier
> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified.diffBDAProducer
> at
> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified.diffBDAProducer(CounterProducerConsumerModified.java:0)
> WELD-001475: The following beans match by type, but none have matching
> qualifiers: - Producer Method [String] with qualifiers
> [@CounterUnmodifiedQualifier @Any] declared as [[BackedAnnotatedMethod]
> @ExcludeClassInterceptors @Produces @CounterUnmodifiedQualifier
> com.ibm.jcdi.test.beansxml.CounterProducerNoModifiers.getCounterBeanProducer()],
> - Producer Method [String] with qualifiers [@BatchProperty @Any]
> declared as [[UnbackedAnnotatedMethod] @Produces @Dependent
> @BatchProperty public com.ibm.jbatch.container.cdi.BatchProducerBean.p
>  msg.seeServerLog
>
>
>
>
>
> The app works fine on OpenWebBeans. Any ideas on what was wrong?
>
> Many thanks,
> Emily
> ===
> Emily Jiang
> WebSphere Application Server, CDI Development Lead
>
> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
> Phone:  +44 (0)1962 816278  Internal: 246278
>
> Email: emiji...@uk.ibm.com
> Lotus Notes: Emily Jiang/UK/IBM@IBMGB
>

-- 
Martin Kouba
Software Engineer
Red Hat, Czech Republic
___
weld-dev mailing list
weld-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev