You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by Frank Jung <ka...@gmx.de> on 2019/02/21 08:14:11 UTC

Issue with inherited Scoped-Annotation?

Hi,

 

it seems that there is an issue with inheriting Scope-Annotations using
OPenWebBeans in an JavaSE environment:

 

If I annotate the bean directly with @RequestScoped all is ok. If I move the
annotation to a base class I get an exception. This only happens in an
JavaSE environment. The same scenario with TomEE 8 PluME works.

 

Before creating a ticket in JIRA I want to ask here if I am doing something
wrong .

 

I used this dependencies in my pom.xml: openwebbeans-se, openwebbeans-spi,
openwebbeans-impl (Version 2.0.8)

 

This is the exception I get:

Exception in thread "main"
org.apache.webbeans.exception.WebBeansDeploymentException:
javax.enterprise.inject.UnsatisfiedResolutionException: Api type
[de.frandly.labor.bootcdidemo.app.RequestBean] is not found with the
qualifiers 

  Qualifiers: [@javax.enterprise.inject.Default()]

  for injection into Field Injection Point, field name :  requestBean, Bean
Owner : [AppMain, WebBeansType:MANAGED, Name:null, API
Types:[de.frandly.labor.bootcdidemo.app.AppMain,java.lang.Object],
Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]

    ...

  Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
type [de.frandly.labor.bootcdidemo.app.RequestBean] is not found with the
qualifiers 

  Qualifiers: [@javax.enterprise.inject.Default()]

  for injection into Field Injection Point, field name :  requestBean, Bean
Owner : [AppMain, WebBeansType:MANAGED, Name:null, API
Types:[de.frandly.labor.bootcdidemo.app.AppMain,java.lang.Object],
Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]

    ...

  Command execution failed.

  org.apache.commons.exec.ExecuteException: Process exited with an error: 1
(Exit value: 1)

    ...

 

Thank you

 

Frankie

 


AW: Issue with inherited Scoped-Annotation?

Posted by Frank Jung <ka...@gmx.de>.
Exactly ... ;-)

Very interesting: 
In the web application the derived bean class ist discovered! And it only has @Named annotation which is not bean defining.
But in the unit tests it is not discovered. 

Since it was working in TomEE I didn't get the idea to check the bean discovery ...

Frankie
-----Ursprüngliche Nachricht-----
Von: Thomas Andraschko [mailto:andraschko.thomas@gmail.com] 
Gesendet: Donnerstag, 21. Februar 2019 11:08
An: openwebbeans-dev
Betreff: Re: Issue with inherited Scoped-Annotation?

maybe bean-discovery=annotated problem?

Am Do., 21. Feb. 2019 um 09:28 Uhr schrieb Romain Manni-Bucau <
rmannibucau@gmail.com>:

> Hi Frank,
>
> TomEE does nothing about it so wonder if it is due to the CDI API
> dependency you use which is likely different and one could lack @Inherited.
>
> As a reference I don't see this issue happening with this sample - and
> dependencies:
>
> import groovy.transform.CompileStatic
>
> @Grab('org.apache.geronimo.specs:geronimo-annotation_1.3_spec:1.1')
> @Grab('org.apache.geronimo.specs:geronimo-jcdi_2.0_spec:1.1')
> @Grab('org.apache.geronimo.specs:geronimo-atinject_1.0_spec:1.0')
> @Grab('org.apache.tomcat:tomcat-el-api:9.0.16')
> @Grab('org.apache.openwebbeans:openwebbeans-se:2.0.6')
> import javax.enterprise.context.RequestScoped
> import javax.enterprise.inject.se.SeContainerInitializer
>
> @CompileStatic
> @RequestScoped
> class Base {
> }
>
> @CompileStatic
> class Child extends Base {
> }
>
> def instance =
> SeContainerInitializer.newInstance().disableDiscovery().addBeanClasses(Base.class,
> Child.class).initialize()
> println
> instance.beanManager.resolve(instance.beanManager.getBeans(Child.class)).scope
> // prints RequestScoped
> instance.close()
>
>
> 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 jeu. 21 févr. 2019 à 09:14, Frank Jung <ka...@gmx.de> a
> écrit :
>
> > Hi,
> >
> >
> >
> > it seems that there is an issue with inheriting Scope-Annotations using
> > OPenWebBeans in an JavaSE environment:
> >
> >
> >
> > If I annotate the bean directly with @RequestScoped all is ok. If I move
> > the
> > annotation to a base class I get an exception. This only happens in an
> > JavaSE environment. The same scenario with TomEE 8 PluME works.
> >
> >
> >
> > Before creating a ticket in JIRA I want to ask here if I am doing
> something
> > wrong .
> >
> >
> >
> > I used this dependencies in my pom.xml: openwebbeans-se,
> openwebbeans-spi,
> > openwebbeans-impl (Version 2.0.8)
> >
> >
> >
> > This is the exception I get:
> >
> > Exception in thread "main"
> > org.apache.webbeans.exception.WebBeansDeploymentException:
> > javax.enterprise.inject.UnsatisfiedResolutionException: Api type
> > [de.frandly.labor.bootcdidemo.app.RequestBean] is not found with the
> > qualifiers
> >
> >   Qualifiers: [@javax.enterprise.inject.Default()]
> >
> >   for injection into Field Injection Point, field name :  requestBean,
> Bean
> > Owner : [AppMain, WebBeansType:MANAGED, Name:null, API
> > Types:[de.frandly.labor.bootcdidemo.app.AppMain,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> >
> >     ...
> >
> >   Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
> > type [de.frandly.labor.bootcdidemo.app.RequestBean] is not found with the
> > qualifiers
> >
> >   Qualifiers: [@javax.enterprise.inject.Default()]
> >
> >   for injection into Field Injection Point, field name :  requestBean,
> Bean
> > Owner : [AppMain, WebBeansType:MANAGED, Name:null, API
> > Types:[de.frandly.labor.bootcdidemo.app.AppMain,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> >
> >     ...
> >
> >   Command execution failed.
> >
> >   org.apache.commons.exec.ExecuteException: Process exited with an
> error: 1
> > (Exit value: 1)
> >
> >     ...
> >
> >
> >
> > Thank you
> >
> >
> >
> > Frankie
> >
> >
> >
> >
>


Re: Issue with inherited Scoped-Annotation?

Posted by Thomas Andraschko <an...@gmail.com>.
maybe bean-discovery=annotated problem?

Am Do., 21. Feb. 2019 um 09:28 Uhr schrieb Romain Manni-Bucau <
rmannibucau@gmail.com>:

> Hi Frank,
>
> TomEE does nothing about it so wonder if it is due to the CDI API
> dependency you use which is likely different and one could lack @Inherited.
>
> As a reference I don't see this issue happening with this sample - and
> dependencies:
>
> import groovy.transform.CompileStatic
>
> @Grab('org.apache.geronimo.specs:geronimo-annotation_1.3_spec:1.1')
> @Grab('org.apache.geronimo.specs:geronimo-jcdi_2.0_spec:1.1')
> @Grab('org.apache.geronimo.specs:geronimo-atinject_1.0_spec:1.0')
> @Grab('org.apache.tomcat:tomcat-el-api:9.0.16')
> @Grab('org.apache.openwebbeans:openwebbeans-se:2.0.6')
> import javax.enterprise.context.RequestScoped
> import javax.enterprise.inject.se.SeContainerInitializer
>
> @CompileStatic
> @RequestScoped
> class Base {
> }
>
> @CompileStatic
> class Child extends Base {
> }
>
> def instance =
> SeContainerInitializer.newInstance().disableDiscovery().addBeanClasses(Base.class,
> Child.class).initialize()
> println
> instance.beanManager.resolve(instance.beanManager.getBeans(Child.class)).scope
> // prints RequestScoped
> instance.close()
>
>
> 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 jeu. 21 févr. 2019 à 09:14, Frank Jung <ka...@gmx.de> a
> écrit :
>
> > Hi,
> >
> >
> >
> > it seems that there is an issue with inheriting Scope-Annotations using
> > OPenWebBeans in an JavaSE environment:
> >
> >
> >
> > If I annotate the bean directly with @RequestScoped all is ok. If I move
> > the
> > annotation to a base class I get an exception. This only happens in an
> > JavaSE environment. The same scenario with TomEE 8 PluME works.
> >
> >
> >
> > Before creating a ticket in JIRA I want to ask here if I am doing
> something
> > wrong .
> >
> >
> >
> > I used this dependencies in my pom.xml: openwebbeans-se,
> openwebbeans-spi,
> > openwebbeans-impl (Version 2.0.8)
> >
> >
> >
> > This is the exception I get:
> >
> > Exception in thread "main"
> > org.apache.webbeans.exception.WebBeansDeploymentException:
> > javax.enterprise.inject.UnsatisfiedResolutionException: Api type
> > [de.frandly.labor.bootcdidemo.app.RequestBean] is not found with the
> > qualifiers
> >
> >   Qualifiers: [@javax.enterprise.inject.Default()]
> >
> >   for injection into Field Injection Point, field name :  requestBean,
> Bean
> > Owner : [AppMain, WebBeansType:MANAGED, Name:null, API
> > Types:[de.frandly.labor.bootcdidemo.app.AppMain,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> >
> >     ...
> >
> >   Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
> > type [de.frandly.labor.bootcdidemo.app.RequestBean] is not found with the
> > qualifiers
> >
> >   Qualifiers: [@javax.enterprise.inject.Default()]
> >
> >   for injection into Field Injection Point, field name :  requestBean,
> Bean
> > Owner : [AppMain, WebBeansType:MANAGED, Name:null, API
> > Types:[de.frandly.labor.bootcdidemo.app.AppMain,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> >
> >     ...
> >
> >   Command execution failed.
> >
> >   org.apache.commons.exec.ExecuteException: Process exited with an
> error: 1
> > (Exit value: 1)
> >
> >     ...
> >
> >
> >
> > Thank you
> >
> >
> >
> > Frankie
> >
> >
> >
> >
>

AW: Issue with inherited Scoped-Annotation?

Posted by Frank Jung <ka...@gmx.de>.
Hi Romain,

thanks for your answer. 

I was able to solve the problem (finding another one) - see my other mail.

Frankie
-----Ursprüngliche Nachricht-----
Von: Romain Manni-Bucau [mailto:rmannibucau@gmail.com] 
Gesendet: Donnerstag, 21. Februar 2019 09:28
An: openwebbeans-dev
Betreff: Re: Issue with inherited Scoped-Annotation?

Hi Frank,

TomEE does nothing about it so wonder if it is due to the CDI API
dependency you use which is likely different and one could lack @Inherited.

As a reference I don't see this issue happening with this sample - and
dependencies:

import groovy.transform.CompileStatic

@Grab('org.apache.geronimo.specs:geronimo-annotation_1.3_spec:1.1')
@Grab('org.apache.geronimo.specs:geronimo-jcdi_2.0_spec:1.1')
@Grab('org.apache.geronimo.specs:geronimo-atinject_1.0_spec:1.0')
@Grab('org.apache.tomcat:tomcat-el-api:9.0.16')
@Grab('org.apache.openwebbeans:openwebbeans-se:2.0.6')
import javax.enterprise.context.RequestScoped
import javax.enterprise.inject.se.SeContainerInitializer

@CompileStatic
@RequestScoped
class Base {
}

@CompileStatic
class Child extends Base {
}

def instance = SeContainerInitializer.newInstance().disableDiscovery().addBeanClasses(Base.class,
Child.class).initialize()
println instance.beanManager.resolve(instance.beanManager.getBeans(Child.class)).scope
// prints RequestScoped
instance.close()


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 jeu. 21 févr. 2019 à 09:14, Frank Jung <ka...@gmx.de> a
écrit :

> Hi,
>
>
>
> it seems that there is an issue with inheriting Scope-Annotations using
> OPenWebBeans in an JavaSE environment:
>
>
>
> If I annotate the bean directly with @RequestScoped all is ok. If I move
> the
> annotation to a base class I get an exception. This only happens in an
> JavaSE environment. The same scenario with TomEE 8 PluME works.
>
>
>
> Before creating a ticket in JIRA I want to ask here if I am doing something
> wrong .
>
>
>
> I used this dependencies in my pom.xml: openwebbeans-se, openwebbeans-spi,
> openwebbeans-impl (Version 2.0.8)
>
>
>
> This is the exception I get:
>
> Exception in thread "main"
> org.apache.webbeans.exception.WebBeansDeploymentException:
> javax.enterprise.inject.UnsatisfiedResolutionException: Api type
> [de.frandly.labor.bootcdidemo.app.RequestBean] is not found with the
> qualifiers
>
>   Qualifiers: [@javax.enterprise.inject.Default()]
>
>   for injection into Field Injection Point, field name :  requestBean, Bean
> Owner : [AppMain, WebBeansType:MANAGED, Name:null, API
> Types:[de.frandly.labor.bootcdidemo.app.AppMain,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>
>     ...
>
>   Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
> type [de.frandly.labor.bootcdidemo.app.RequestBean] is not found with the
> qualifiers
>
>   Qualifiers: [@javax.enterprise.inject.Default()]
>
>   for injection into Field Injection Point, field name :  requestBean, Bean
> Owner : [AppMain, WebBeansType:MANAGED, Name:null, API
> Types:[de.frandly.labor.bootcdidemo.app.AppMain,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>
>     ...
>
>   Command execution failed.
>
>   org.apache.commons.exec.ExecuteException: Process exited with an error: 1
> (Exit value: 1)
>
>     ...
>
>
>
> Thank you
>
>
>
> Frankie
>
>
>
>


Re: Issue with inherited Scoped-Annotation?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Frank,

TomEE does nothing about it so wonder if it is due to the CDI API
dependency you use which is likely different and one could lack @Inherited.

As a reference I don't see this issue happening with this sample - and
dependencies:

import groovy.transform.CompileStatic

@Grab('org.apache.geronimo.specs:geronimo-annotation_1.3_spec:1.1')
@Grab('org.apache.geronimo.specs:geronimo-jcdi_2.0_spec:1.1')
@Grab('org.apache.geronimo.specs:geronimo-atinject_1.0_spec:1.0')
@Grab('org.apache.tomcat:tomcat-el-api:9.0.16')
@Grab('org.apache.openwebbeans:openwebbeans-se:2.0.6')
import javax.enterprise.context.RequestScoped
import javax.enterprise.inject.se.SeContainerInitializer

@CompileStatic
@RequestScoped
class Base {
}

@CompileStatic
class Child extends Base {
}

def instance = SeContainerInitializer.newInstance().disableDiscovery().addBeanClasses(Base.class,
Child.class).initialize()
println instance.beanManager.resolve(instance.beanManager.getBeans(Child.class)).scope
// prints RequestScoped
instance.close()


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 jeu. 21 févr. 2019 à 09:14, Frank Jung <ka...@gmx.de> a
écrit :

> Hi,
>
>
>
> it seems that there is an issue with inheriting Scope-Annotations using
> OPenWebBeans in an JavaSE environment:
>
>
>
> If I annotate the bean directly with @RequestScoped all is ok. If I move
> the
> annotation to a base class I get an exception. This only happens in an
> JavaSE environment. The same scenario with TomEE 8 PluME works.
>
>
>
> Before creating a ticket in JIRA I want to ask here if I am doing something
> wrong .
>
>
>
> I used this dependencies in my pom.xml: openwebbeans-se, openwebbeans-spi,
> openwebbeans-impl (Version 2.0.8)
>
>
>
> This is the exception I get:
>
> Exception in thread "main"
> org.apache.webbeans.exception.WebBeansDeploymentException:
> javax.enterprise.inject.UnsatisfiedResolutionException: Api type
> [de.frandly.labor.bootcdidemo.app.RequestBean] is not found with the
> qualifiers
>
>   Qualifiers: [@javax.enterprise.inject.Default()]
>
>   for injection into Field Injection Point, field name :  requestBean, Bean
> Owner : [AppMain, WebBeansType:MANAGED, Name:null, API
> Types:[de.frandly.labor.bootcdidemo.app.AppMain,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>
>     ...
>
>   Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
> type [de.frandly.labor.bootcdidemo.app.RequestBean] is not found with the
> qualifiers
>
>   Qualifiers: [@javax.enterprise.inject.Default()]
>
>   for injection into Field Injection Point, field name :  requestBean, Bean
> Owner : [AppMain, WebBeansType:MANAGED, Name:null, API
> Types:[de.frandly.labor.bootcdidemo.app.AppMain,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>
>     ...
>
>   Command execution failed.
>
>   org.apache.commons.exec.ExecuteException: Process exited with an error: 1
> (Exit value: 1)
>
>     ...
>
>
>
> Thank you
>
>
>
> Frankie
>
>
>
>