You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@openwebbeans.apache.org by Laird Nelson <lj...@gmail.com> on 2018/12/14 19:08:25 UTC
@Intercepted Bean> failure
Hello; before I file an issue I'd like to check the behavior I'm observing
with this list. I've also put this on StackOverflow (
https://stackoverflow.com/questions/53771466/is-intercepted-bean-a-legal-type-and-qualifier-pair-to-inject
).
I am using the Narayana transaction CDI machinery (
https://github.com/jbosstm/narayana/tree/master/ArjunaJTA/cdi/classes/com/arjuna/ats/jta/cdi).
It works fine in a standalone CDI 2.0 application when Weld is the
implementation. It fails in OpenWebBeans 2.0.8.
Specifically, the Narayana project includes several interceptors (
https://github.com/jbosstm/narayana/tree/master/ArjunaJTA/cdi/classes/com/arjuna/ats/jta/cdi/transactional).
The common base class they all share has this code (
https://github.com/jbosstm/narayana/blob/77a4ea35287cb2057b62b6d65e99efd96c55074a/ArjunaJTA/cdi/classes/com/arjuna/ats/jta/cdi/transactional/TransactionalInterceptorBase.java#L69-L71
):
@Inject
@Intercepted
private Bean<?> interceptedBean;
A standalone CDI application attempting to use a transactional method:
@Transactional(TxType.REQUIRED)
public void frobnicate() {
// whatever
}
…fails with (ultimately):
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api type
[javax.enterprise.inject.spi.Bean] is not found with the qualifiers
Qualifiers:
[@javax.enterprise.inject.Intercepted(),@javax.inject.Named(value="interceptedBean")]
for injection into Field Injection Point, field name : interceptedBean,
Bean Owner : [TransactionalInterceptorNotSupported,
WebBeansType:INTERCEPTOR, Name:null, API
Types:[com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase
[and so on]
Note the @Named(value="interceptedBean") qualifier. I'm not sure why that
shows up as the Narayana extension does not add that qualifier and it is
not present in the interceptor.
I assume this is a bug in OpenWebBeans, yes?
Best,
Laird
Re: @Intercepted Bean> failure
Posted by Laird Nelson <lj...@gmail.com>.
Yep; working on it; thanks!
On Mon, Dec 17, 2018 at 12:42 PM Romain Manni-Bucau <rm...@gmail.com>
wrote:
> Maybe push the reproducer on github to let us run it.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> | Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Book
> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>
>
> Le lun. 17 déc. 2018 à 19:21, Laird Nelson <lj...@gmail.com> a écrit :
>
>> The same "stack" works fine with Weld. Still digging.
>>
>> On Mon, Dec 17, 2018 at 9:21 AM Romain Manni-Bucau <rm...@gmail.com>
>> wrote:
>>
>>> The test reproduces the abstraction and the registration does not change
>>> the code path so it can be a "bad stack" which would make the OWB
>>> BeanMetadataProducer not finding the bean?
>>>
>>>
>>> Romain Manni-Bucau
>>> @rmannibucau <https://twitter.com/rmannibucau> | Blog
>>> <https://rmannibucau.metawerx.net/> | Old Blog
>>> <http://rmannibucau.wordpress.com> | Github
>>> <https://github.com/rmannibucau> | LinkedIn
>>> <https://www.linkedin.com/in/rmannibucau> | Book
>>> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>>>
>>>
>>> Le lun. 17 déc. 2018 à 18:09, Laird Nelson <lj...@gmail.com> a
>>> écrit :
>>>
>>>> On Mon, Dec 17, 2018 at 12:12 AM Romain Manni-Bucau <
>>>> rmannibucau@gmail.com> wrote:
>>>>
>>>>> Hello Laird,
>>>>>
>>>>> I didn't manage to reproduce with this test:
>>>>>
>>>>
>>>> Yes, but that test is different from the structure and usage of the
>>>> Narayana transaction componentry in many ways. For example, the Narayana
>>>> extension adds the interceptor types as annotated types (i.e. does not call
>>>> addInterceptor()), and the interceptedBean field is in a base class, not
>>>> the actual interceptor. I don't know why (or if) this would make a
>>>> difference, of course, but using the Narayana extension does indeed fail
>>>> under OpenWebBeans. I'll continue digging.
>>>>
>>>> Best,
>>>> Laird
>>>>
>>>
Re: @Intercepted Bean> failure
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Maybe push the reproducer on github to let us run it.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Le lun. 17 déc. 2018 à 19:21, Laird Nelson <lj...@gmail.com> a écrit :
> The same "stack" works fine with Weld. Still digging.
>
> On Mon, Dec 17, 2018 at 9:21 AM Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
>> The test reproduces the abstraction and the registration does not change
>> the code path so it can be a "bad stack" which would make the OWB
>> BeanMetadataProducer not finding the bean?
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau <https://twitter.com/rmannibucau> | Blog
>> <https://rmannibucau.metawerx.net/> | Old Blog
>> <http://rmannibucau.wordpress.com> | Github
>> <https://github.com/rmannibucau> | LinkedIn
>> <https://www.linkedin.com/in/rmannibucau> | Book
>> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>>
>>
>> Le lun. 17 déc. 2018 à 18:09, Laird Nelson <lj...@gmail.com> a écrit :
>>
>>> On Mon, Dec 17, 2018 at 12:12 AM Romain Manni-Bucau <
>>> rmannibucau@gmail.com> wrote:
>>>
>>>> Hello Laird,
>>>>
>>>> I didn't manage to reproduce with this test:
>>>>
>>>
>>> Yes, but that test is different from the structure and usage of the
>>> Narayana transaction componentry in many ways. For example, the Narayana
>>> extension adds the interceptor types as annotated types (i.e. does not call
>>> addInterceptor()), and the interceptedBean field is in a base class, not
>>> the actual interceptor. I don't know why (or if) this would make a
>>> difference, of course, but using the Narayana extension does indeed fail
>>> under OpenWebBeans. I'll continue digging.
>>>
>>> Best,
>>> Laird
>>>
>>
Re: @Intercepted Bean> failure
Posted by Laird Nelson <lj...@gmail.com>.
The same "stack" works fine with Weld. Still digging.
On Mon, Dec 17, 2018 at 9:21 AM Romain Manni-Bucau <rm...@gmail.com>
wrote:
> The test reproduces the abstraction and the registration does not change
> the code path so it can be a "bad stack" which would make the OWB
> BeanMetadataProducer not finding the bean?
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> | Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Book
> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>
>
> Le lun. 17 déc. 2018 à 18:09, Laird Nelson <lj...@gmail.com> a écrit :
>
>> On Mon, Dec 17, 2018 at 12:12 AM Romain Manni-Bucau <
>> rmannibucau@gmail.com> wrote:
>>
>>> Hello Laird,
>>>
>>> I didn't manage to reproduce with this test:
>>>
>>
>> Yes, but that test is different from the structure and usage of the
>> Narayana transaction componentry in many ways. For example, the Narayana
>> extension adds the interceptor types as annotated types (i.e. does not call
>> addInterceptor()), and the interceptedBean field is in a base class, not
>> the actual interceptor. I don't know why (or if) this would make a
>> difference, of course, but using the Narayana extension does indeed fail
>> under OpenWebBeans. I'll continue digging.
>>
>> Best,
>> Laird
>>
>
Re: @Intercepted Bean> failure
Posted by Romain Manni-Bucau <rm...@gmail.com>.
The test reproduces the abstraction and the registration does not change
the code path so it can be a "bad stack" which would make the OWB
BeanMetadataProducer not finding the bean?
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Le lun. 17 déc. 2018 à 18:09, Laird Nelson <lj...@gmail.com> a écrit :
> On Mon, Dec 17, 2018 at 12:12 AM Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
>> Hello Laird,
>>
>> I didn't manage to reproduce with this test:
>>
>
> Yes, but that test is different from the structure and usage of the
> Narayana transaction componentry in many ways. For example, the Narayana
> extension adds the interceptor types as annotated types (i.e. does not call
> addInterceptor()), and the interceptedBean field is in a base class, not
> the actual interceptor. I don't know why (or if) this would make a
> difference, of course, but using the Narayana extension does indeed fail
> under OpenWebBeans. I'll continue digging.
>
> Best,
> Laird
>
Re: @Intercepted Bean> failure
Posted by Laird Nelson <lj...@gmail.com>.
On Mon, Dec 17, 2018 at 12:12 AM Romain Manni-Bucau <rm...@gmail.com>
wrote:
> Hello Laird,
>
> I didn't manage to reproduce with this test:
>
Yes, but that test is different from the structure and usage of the
Narayana transaction componentry in many ways. For example, the Narayana
extension adds the interceptor types as annotated types (i.e. does not call
addInterceptor()), and the interceptedBean field is in a base class, not
the actual interceptor. I don't know why (or if) this would make a
difference, of course, but using the Narayana extension does indeed fail
under OpenWebBeans. I'll continue digging.
Best,
Laird
Re: @Intercepted Bean> failure
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hello Laird,
I didn't manage to reproduce with this test:
import static org.junit.Assert.assertEquals;
import java.io.Serializable;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Intercepted;
import javax.enterprise.inject.spi.Bean;
import javax.inject.Inject;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
import org.apache.webbeans.test.AbstractUnitTest;
import org.apache.webbeans.test.component.event.normal.Transactional;
import org.junit.Test;
public class BeanMetadataInterceptedTest extends AbstractUnitTest
{
@Test
public void checkIntercepted()
{
addInterceptor(TransactionalInterceptor.class);
startContainerInnerClasses();
assertEquals(SomeBean.class.getName(),
getInstance(SomeBean.class).name());
}
@Transactional
@ApplicationScoped
public static class SomeBean
{
public String name() {
return "failed";
}
}
@Interceptor
@Transactional
public static class TransactionalInterceptorBase implements Serializable
{
@Inject
@Intercepted
protected Bean<?> interceptedBean;
}
@Interceptor
@Transactional
public static class TransactionalInterceptor extends
TransactionalInterceptorBase
{
@AroundInvoke
public Object caller(final InvocationContext context)
{
return interceptedBean.getBeanClass().getName();
}
}
}
However I guess you can use
<dependency>
<groupId>org.apache.meecrowave</groupId>
<artifactId>meecrowave-jta</artifactId>
<version>1.2.4</version>
</dependency>
in the meantime
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Le lun. 17 déc. 2018 à 08:50, Mark Struberg <st...@yahoo.de> a écrit :
> Hi Laird, sorry for the delay!
>
> Gonna look at your example soon.
>
> LieGrue,
> strub
>
>
> > Am 14.12.2018 um 20:08 schrieb Laird Nelson <lj...@gmail.com>:
> >
> > Hello; before I file an issue I'd like to check the behavior I'm
> observing with this list. I've also put this on StackOverflow (
> https://stackoverflow.com/questions/53771466/is-intercepted-bean-a-legal-type-and-qualifier-pair-to-inject
> ).
> >
> > I am using the Narayana transaction CDI machinery (
> https://github.com/jbosstm/narayana/tree/master/ArjunaJTA/cdi/classes/com/arjuna/ats/jta/cdi).
> It works fine in a standalone CDI 2.0 application when Weld is the
> implementation. It fails in OpenWebBeans 2.0.8.
> >
> > Specifically, the Narayana project includes several interceptors (
> https://github.com/jbosstm/narayana/tree/master/ArjunaJTA/cdi/classes/com/arjuna/ats/jta/cdi/transactional).
> The common base class they all share has this code (
> https://github.com/jbosstm/narayana/blob/77a4ea35287cb2057b62b6d65e99efd96c55074a/ArjunaJTA/cdi/classes/com/arjuna/ats/jta/cdi/transactional/TransactionalInterceptorBase.java#L69-L71
> ):
> >
> > @Inject
> > @Intercepted
> > private Bean<?> interceptedBean;
> >
> > A standalone CDI application attempting to use a transactional method:
> >
> > @Transactional(TxType.REQUIRED)
> > public void frobnicate() {
> > // whatever
> > }
> >
> > …fails with (ultimately):
> >
> > Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
> type [javax.enterprise.inject.spi.Bean] is not found with the qualifiers
> > Qualifiers:
> [@javax.enterprise.inject.Intercepted(),@javax.inject.Named(value="interceptedBean")]
> > for injection into Field Injection Point, field name : interceptedBean,
> Bean Owner : [TransactionalInterceptorNotSupported,
> WebBeansType:INTERCEPTOR, Name:null, API
> Types:[com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase
> [and so on]
> >
> > Note the @Named(value="interceptedBean") qualifier. I'm not sure why
> that shows up as the Narayana extension does not add that qualifier and it
> is not present in the interceptor.
> >
> > I assume this is a bug in OpenWebBeans, yes?
> >
> > Best,
> > Laird
>
>
Re: @Intercepted Bean> failure
Posted by Mark Struberg <st...@yahoo.de>.
Hi Laird, sorry for the delay!
Gonna look at your example soon.
LieGrue,
strub
> Am 14.12.2018 um 20:08 schrieb Laird Nelson <lj...@gmail.com>:
>
> Hello; before I file an issue I'd like to check the behavior I'm observing with this list. I've also put this on StackOverflow (https://stackoverflow.com/questions/53771466/is-intercepted-bean-a-legal-type-and-qualifier-pair-to-inject).
>
> I am using the Narayana transaction CDI machinery (https://github.com/jbosstm/narayana/tree/master/ArjunaJTA/cdi/classes/com/arjuna/ats/jta/cdi). It works fine in a standalone CDI 2.0 application when Weld is the implementation. It fails in OpenWebBeans 2.0.8.
>
> Specifically, the Narayana project includes several interceptors (https://github.com/jbosstm/narayana/tree/master/ArjunaJTA/cdi/classes/com/arjuna/ats/jta/cdi/transactional). The common base class they all share has this code (https://github.com/jbosstm/narayana/blob/77a4ea35287cb2057b62b6d65e99efd96c55074a/ArjunaJTA/cdi/classes/com/arjuna/ats/jta/cdi/transactional/TransactionalInterceptorBase.java#L69-L71):
>
> @Inject
> @Intercepted
> private Bean<?> interceptedBean;
>
> A standalone CDI application attempting to use a transactional method:
>
> @Transactional(TxType.REQUIRED)
> public void frobnicate() {
> // whatever
> }
>
> …fails with (ultimately):
>
> Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [javax.enterprise.inject.spi.Bean] is not found with the qualifiers
> Qualifiers: [@javax.enterprise.inject.Intercepted(),@javax.inject.Named(value="interceptedBean")]
> for injection into Field Injection Point, field name : interceptedBean, Bean Owner : [TransactionalInterceptorNotSupported, WebBeansType:INTERCEPTOR, Name:null, API Types:[com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase [and so on]
>
> Note the @Named(value="interceptedBean") qualifier. I'm not sure why that shows up as the Narayana extension does not add that qualifier and it is not present in the interceptor.
>
> I assume this is a bug in OpenWebBeans, yes?
>
> Best,
> Laird