Yes, static is fine. See section 3.3. But @Inject is _not_
"If a producer method is annotated @Inject, has a parameter annotated @Disposes, or has a parameter annotated @Observes, the container automatically detects the problem and treats it as a definition error." Wonder if Glassfish ever passed the Java EE TCK ... ;) LieGrue, strub On Wednesday, 12 February 2014, 18:03, John D. Ament <[email protected]> wrote: Is the static modifier also acceptable? > > >On Wed, Feb 12, 2014 at 11:33 AM, Romain Manni-Bucau ><[email protected]> wrote: >> Hi >> >> try to remove @Inject from the producer method >> Romain Manni-Bucau >> Twitter: @rmannibucau >> Blog: http://rmannibucau.wordpress.com/ >> LinkedIn: http://fr.linkedin.com/in/rmannibucau >> Github: https://github.com/rmannibucau >> >> >> >> 2014-02-12 15:44 GMT+01:00 Rene Perschon <[email protected]>: >>> Hi! >>> >>> I'm currently migrating an application from glassfish to TomEE. During the >>> deployment however i get this error message and the deployment fails: >>> >>> CDI Beans module deployment failed >>> org.apache.webbeans.exception.inject.DeploymentException: >>> org.apache.webbeans.exception.WebBeansConfigurationException: Producer >>> annotated method : Annotated Method 'produceBookingRequestBuilder', Base >>> Type : class de.itso.mdbp.service.BookingRequestBuilder,Type Closures : >>> null,Annotations : [@javax.inject.Inject(), >>> @de.itso.mdbp.web.qualifier.BookingRequestBuilderInConversation(), >>> @javax.enterprise.context.ConversationScoped(), >>> @javax.enterprise.inject.Produces()],Java Member Name : >>> produceBookingRequestBuilder,Annotated Parameters : [Annotated >>> Parameter,Base Type : interface javax.enterprise.context.Conversation,Type >>> Closures : null,Annotations : [],Position : 0] can not be annotated with >>> @Initializer/@Destructor annotation or has a parameter annotated with >>> @Disposes/@Observes >>> at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:226) >>> at >>> org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:187) >>> at >>> org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:162) >>> at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:43) >>> at >>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:799) >>> at >>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:612) >>> at >>> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1205) >>> at >>> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1051) >>> at >>> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:127) >>> at >>> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) >>> at >>> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) >>> at >>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322) >>> 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:633) >>> at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:983) >>> at >>> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1660) >>> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) >>> at java.util.concurrent.FutureTask.run(FutureTask.java:262) >>> at >>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) >>> at >>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) >>> at java.lang.Thread.run(Thread.java:744) >>> >>> The producer looks like this: >>> >>> @Produces >>> @ConversationScoped >>> @BookingRequestBuilderInConversation >>> @Inject >>> public static final BookingRequestBuilder >>> produceBookingRequestBuilder(Conversation conversation) >>> { >>> if (conversation.isTransient()) >>> { >>> conversation.begin(); >>> } >>> BookingRequestBuilder brb = null; >>> try >>> { >>> brb = (BookingRequestBuilder) LookupUtil.lookup("BookingRequestBuilder"); >>> } >>> catch (NamingException e) >>> { >>> Logger.getLogger(UserDetailsProducer.class).error("Cannot obtain a handle >>> to the BookingRequestBuilder!", e); >>> return null; >>> } >>> return brb; >>> } >>> >>> And the additional qualifier looks like this: >>> >>> @Qualifier >>> @Target({ TYPE, METHOD, PARAMETER, FIELD }) >>> @Retention(RUNTIME) >>> @Documented >>> public @interface BookingRequestBuilderInConversation >>> { >>> } >>> >>> Now I can't find the issue here, what's wrong with that? It did deploy to >>> glassfish all right (i think glassfish uses weld?). Can anybody help me >>> here? >>> >>> Thanks in advance! >>> René > >
