Hi Romain

What should I not do during the boot of the container?

The @RequestScoped bean injecting the extension is not until it receives an
event triggered by a client request

Regards
Lars-Fredrik
On Dec 5, 2014 3:45 PM, "Romain Manni-Bucau" <[email protected]> wrote:

> you shouldn't do it during the boot of the container. I guess that's
> the issue. What I don't get is why it doesn't fail more abruptally.
>
>
> Romain Manni-Bucau
> @rmannibucau
> http://www.tomitribe.com
> http://rmannibucau.wordpress.com
> https://github.com/rmannibucau
>
>
> 2014-12-05 15:40 GMT+01:00 Lars-Fredrik Smedberg <[email protected]>:
> > Romain, what I tried in my little tests was:
> >
> > - A class implementing ServletRequestListener that in
> > requestInitialized(...) fires a CDI event.
> > - Another class (@RequestScoped) consumes the event...
> >
> > Without any injection of the CDI Extension all work fine
> >
> > - I added a CDI Extension and when debugging I can see that the extension
> > can observe the events postsed during startup.
> > - When I in the the @RequestScoped class that consumes the events @Inject
> > the extension I get an error and a stack trace (at the bottom of the
> mail):
> >
> > If I only add the CDI Extension but not inject it in any bean I can see
> > that it (amongst other events) observes an AfterDeploymentValidation
> event.
> >
> > When injecting the CDI Extension to the bean mentioned above I not
> receive
> > the AfterDeploymentValidation event, the error happens before (the
> > extension observes BeforeBeanDiscovery, ProcessAnnotatedType and
> > AfterDeploymentValidation).
> >
> > Any ideas of what might be wrong?
> >
> > Regards
> > LF
> >
> > ----------------------
> >
> > SEVERE: CDI Beans module deployment failed
> > org.apache.webbeans.exception.inject.DeploymentException:
> > javax.enterprise.inject.UnsatisfiedResolutionException: Api type
> > [test.JAXBContextExtension] is not found with the qualifiers
> > Qualifiers: [@javax.enterprise.inject.Default()]
> > for injection into Field Injection Point, field name :
> >  jaxbContextExtension, Bean Owner : [ServiceRequestConsumer, Name:null,
> > WebBeans Type:MANAGED, API
> > Types:[java.lang.Object,test.ServiceRequestConsumer],
> > Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]
> > at
> org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:215)
> > at
> >
> org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:194)
> > at
> >
> org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:160)
> > at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:41)
> > at
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:797)
> > at
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:623)
> > at
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1248)
> > at
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1087)
> > at
> >
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
> > at
> >
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
> > at
> >
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
> > at
> >
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5378)
> > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> > at
> >
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
> > at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
> > at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
> > at
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.deployWar(TomcatWebAppBuilder.java:648)
> > at
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.deployWebApps(TomcatWebAppBuilder.java:618)
> > at
> >
> org.apache.tomee.catalina.deployment.TomcatWebappDeployer.deploy(TomcatWebappDeployer.java:43)
> > at org.apache.openejb.assembler.DeployerEjb.deploy(DeployerEjb.java:175)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:601)
> > at
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
> > at
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
> > at
> >
> org.apache.openejb.security.internal.InternalSecurityInterceptor.invoke(InternalSecurityInterceptor.java:35)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:601)
> > at
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
> > at
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
> > at
> >
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
> > at
> >
> org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:601)
> > at
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
> > at
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
> > at
> >
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
> > at
> >
> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:227)
> > at
> >
> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:194)
> > at
> >
> org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:370)
> > at
> >
> org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:181)
> > at
> >
> org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:344)
> > at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:240)
> > at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:86)
> > at
> >
> org.apache.openejb.server.httpd.ServerServlet.service(ServerServlet.java:58)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
> > at
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
> > at
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> > at
> >
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
> > at
> >
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
> > at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
> > at
> >
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
> > at
> >
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
> > at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
> > at
> >
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
> > at
> >
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
> > at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
> > at
> >
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
> > at
> >
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
> > at
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> > at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> > at
> >
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> > at java.lang.Thread.run(Thread.java:722)
> > Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
> type
> > [test.JAXBContextExtension] is not found with the qualifiers
> > Qualifiers: [@javax.enterprise.inject.Default()]
> > for injection into Field Injection Point, field name :
> >  jaxbContextExtension, Bean Owner : [ServiceRequestConsumer, Name:null,
> > WebBeans Type:MANAGED, API
> > Types:[java.lang.Object,test.ServiceRequestConsumer],
> > Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]
> > at
> >
> org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:60)
> > at
> >
> org.apache.webbeans.container.InjectionResolver.checkInjectionPoint(InjectionResolver.java:195)
> > at
> >
> org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:955)
> > at
> org.apache.webbeans.config.BeansDeployer.validate(BeansDeployer.java:491)
> > at
> >
> org.apache.webbeans.config.BeansDeployer.validateInjectionPoints(BeansDeployer.java:422)
> > at
> org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:202)
> > ... 67 more
> >
> >
> > On Fri, Dec 5, 2014 at 2:24 PM, Romain Manni-Bucau <
> [email protected]>
> > wrote:
> >
> >> Hi
> >>
> >> seems ok yes
> >>
> >>
> >> Romain Manni-Bucau
> >> @rmannibucau
> >> http://www.tomitribe.com
> >> http://rmannibucau.wordpress.com
> >> https://github.com/rmannibucau
> >>
> >>
> >> 2014-12-05 14:15 GMT+01:00 Lars-Fredrik Smedberg <[email protected]>:
> >> > Hi
> >> >
> >> > I'm running TomEE Plus 1.7.1 and I try to inject a CDI extension in a
> >> > @RequestScoped bean but I get an error saying that no bean with
> @Default
> >> is
> >> > available for injection.
> >> >
> >> > Is this the right way of getting data  collected in the extension
> >> available
> >> > to the application?
> >> >
> >> > Regards
> >> > Lars-Fredrik
> >>
> >
> >
> >
> > --
> > Med vänlig hälsning / Best regards
> >
> > Lars-Fredrik Smedberg
> >
> > STATEMENT OF CONFIDENTIALITY:
> > The information contained in this electronic message and any
> > attachments to this message are intended for the exclusive use of the
> > address(es) and may contain confidential or privileged information. If
> > you are not the intended recipient, please notify Lars-Fredrik Smedberg
> > immediately at [email protected], and destroy all copies of this
> > message and any attachments.
>

Reply via email to