Hi, If you have issues with openejb or tomee submit them to the list. Mdb and cdi works fine btw. Le 17 janv. 2013 20:04, "Mike Olson" <[email protected]> a écrit :
> On 1/17/2013 10:49 AM, Mark Struberg wrote: > >> Hi Mike! >> >> That should work, as this will be set by the EJB container. What die you >> use to start your unit tests? >> TomEE-Arquillian? or DeltaSpike CdiControl-tomee ? Stock CDI is not >> enough in that case, this really needs an EJB container for handling JMS ... >> > > Hi Mark, > > I am using stock CDI for my unit tests. I don't actually send messages > over JMS during unit tests, I just invoke the the onMessage to test the > handling. The broken tests where minor and easily resolved. > > > So now I am trying to get openwebbeans-jms working and having a bugger > of a time. I am just trying to get the JMS sample program to run and am > getting > > SEVERE: Api type [javax.jms.QueueSession] is not found with the qualifiers > Qualifiers: [@test.JmsBinding()] > > So I am missing something yet... > > >> >> If you use OpenEJB, then you will get OpenWebBeans transitively (OpenEJB >> uses OWB for handling all the CDI parts). >> > I tried using openEJB and tomee but it did not work (1.5.1 I think was the > version). tomcat (and/or tomee) would not even start up. No webapps > installed. Just download, install and try and run and it was broken. > > There was a known bug with Windows installation. It was supposed to be > fixed so I downloaded and built a snapshot...and got different errors. CDI > and JMS where my main concerns so I started down the path of just adding > them separately. > > > >> >> Regarding the @Singleton question in the other post: >> >> * how many instances do you get if you have this Singleton in a JVM? >> >> * how many instances do you get if you have this Singleton in multiple >> JVMs? >> * how many instances do you get if you have this Singleton in multple >> WARs? >> >> The term 'Singleton' is really completely useless without knowing the >> exact scope of it. >> E.g. a @SessionScoped bean could be thought of as a 'session-singleton', >> got it? >> > Yes, it makes sense now. > > Thanks for your help > Mike > > > >> >> LieGrue, >> strub >> >> >> >> ----- Original Message ----- >> >>> From: Mike Olson <[email protected]> >>> To: [email protected] >>> Cc: >>> Sent: Thursday, January 17, 2013 6:28 PM >>> Subject: Re: WebBeans context with scope type annotation @Singleton does >>> not exist within current thread >>> >>> On 1/17/2013 2:54 AM, Mark Struberg wrote: >>> >>> >>> Hi Mark, >>> >>> I made the change so I no longer use the Singleton scope. >>> >>> Now I get a very similar error saying "WebBeans context with scope >>> type annotation @ApplicationScoped does not exist within current thread". >>> >>> This is occurring in my onMessage callback on a JMS MessageListener. >>> >>> Based on what I have read, ApplicatonScoped beans should be available >>> "during any message delivery to a MessageListener for a JMS topic or >>> queue obtained from the Java EE component environment". >>> >>> Am I missing something? Do I need to have openwebeans-jms included >>> in my project? I have not found too much documentation on what that >>> project provides. Looking at the sample it seems to deal with binding >>> Queues/Topics to specific names defined in the beans.xml file, but maybe >>> it adds support for more. >>> >>> If not the jms project, then do I need to use the ContextControl >>> class in every single one of my message handlers? >>> >>> Thanks >>> Mike >>> >>> Hi Mike, that's an easy one :) >>>> >>>> You tried to access a @javax.inject.Singleton scoped bean in a Thread >>>> where >>>> >>> this context didn't get activated. >>> >>>> I generally recommend against using the atinject @Singleton! Contrary >>>> to >>>> >>> the javax.ejb.Singleton it has an undefined lifecycle, so it's barely >>> useful. Please use a simple @ApplicationScoped instead. >>> >>>> LieGrue, >>>> strub >>>> >>>> >>>> >>>> PS: if you start new Threads manually yourself, then please look at >>>> >>> DeltaSpike-CdiCtrl ContextControl. >>> >>>> >>>> >>>> ----- Original Message ----- >>>> >>>>> From: Mike Olson <[email protected]> >>>>> To: [email protected] >>>>> Cc: >>>>> Sent: Thursday, January 17, 2013 9:52 AM >>>>> Subject: WebBeans context with scope type annotation @Singleton does >>>>> >>>> not exist within current thread >>> >>>> Hello, >>>>> >>>>> >>>>> I am trying to figure out exactly what this exception is trying to >>>>> >>>> tell me. I >>> >>>> have multiple web applications that are communicating with JMS and >>>>> this >>>>> >>>> is >>> >>>> occurring during a MessageListener call back so my assumption is that >>>>> >>>> it has >>> >>>> something to do with being multi-threaded. However, I am also using >>>>> >>>> the >>> >>>> "Provider" again so it could be another issue with that. >>>>> >>>>> I am doing something similar to: >>>>> >>>>> @Inject >>>>> Provider<Foo> fooProvider; >>>>> >>>>> public void onMessage(Message m) { >>>>> fooProvider.get(); >>>>> } >>>>> >>>>> >>>>> In the ".get()" call is where the exception occurs. I have >>>>> >>>> been >>> >>>> through the code and inspected all of the Inject fields in the class >>>>> >>>> hierarchy >>> >>>> of "Foo". There are some that are scoped as @Singleton. I >>>>> >>>> have >>> >>>> removed that scope from all of them, but I still get the same >>>>> >>>> exception. >>> >>>> >>>>> Anyone have any ideas? Here is the traceback. >>>>> Thanks >>>>> Mike >>>>> >>>>> >>>>> javax.enterprise.context.**ContextNotActiveException: WebBeans >>>>> context >>>>> >>>> with scope >>> >>>> type annotation @Singleton does not exist within current thread >>>>> at >>>>> >>>>> org.apache.webbeans.container.**BeanManagerImpl.getContext(** >>> BeanManagerImpl.java:351) >>> >>>> at >>>>> >>>>> org.apache.webbeans.container.**BeanManagerImpl.getReference(** >>> BeanManagerImpl.java:861) >>> >>>> at >>>>> >>>>> org.apache.webbeans.container.**BeanManagerImpl.** >>> getInjectableReference(**BeanManagerImpl.java:759) >>> >>>> at >>>>> >>>>> org.apache.webbeans.inject.**AbstractInjectable.inject(** >>> AbstractInjectable.java:136) >>> >>>> at >>>>> >>>>> org.apache.webbeans.inject.**InjectableField.doInjection(** >>> InjectableField.java:59) >>> >>>> at >>>>> >>>>> org.apache.webbeans.component.**AbstractInjectionTargetBean.** >>> injectField(**AbstractInjectionTargetBean.**java:387) >>> >>>> at >>>>> >>>>> org.apache.webbeans.component.**AbstractInjectionTargetBean.** >>> injectFields(**AbstractInjectionTargetBean.**java:324) >>> >>>> at >>>>> >>>>> org.apache.webbeans.portable.**creation.**InjectionTargetProducer.** >>> inject(**InjectionTargetProducer.java:**95) >>> >>>> at >>>>> >>>>> org.apache.webbeans.component.**InjectionTargetWrapper.inject(** >>> InjectionTargetWrapper.java:**76) >>> >>>> at >>>>> >>>>> org.apache.webbeans.component.**AbstractOwbBean.create(** >>> AbstractOwbBean.java:181) >>> >>>> at >>>>> >>>>> org.apache.webbeans.context.**DependentContext.getInstance(** >>> DependentContext.java:70) >>> >>>> at >>>>> >>>> org.apache.webbeans.context.**AbstractContext.get(** >>> AbstractContext.java:132) >>> >>>> at >>>>> >>>>> org.apache.webbeans.container.**BeanManagerImpl.getReference(** >>> BeanManagerImpl.java:872) >>> >>>> at >>>>> >>>>> org.apache.webbeans.container.**BeanManagerImpl.** >>> getInjectableReference(**BeanManagerImpl.java:753) >>> >>>> at >>>>> >>>>> org.apache.webbeans.inject.**AbstractInjectable.inject(** >>> AbstractInjectable.java:136) >>> >>>> at >>>>> >>>>> org.apache.webbeans.inject.**InjectableField.doInjection(** >>> InjectableField.java:59) >>> >>>> at >>>>> >>>>> org.apache.webbeans.component.**AbstractInjectionTargetBean.** >>> injectField(**AbstractInjectionTargetBean.**java:387) >>> >>>> at >>>>> >>>>> org.apache.webbeans.component.**AbstractInjectionTargetBean.** >>> injectSuperFields(**AbstractInjectionTargetBean.**java:368) >>> >>>> at >>>>> >>>>> org.apache.webbeans.portable.**creation.**InjectionTargetProducer.** >>> inject(**InjectionTargetProducer.java:**93) >>> >>>> at >>>>> >>>>> org.apache.webbeans.component.**InjectionTargetWrapper.inject(** >>> InjectionTargetWrapper.java:**76) >>> >>>> at >>>>> >>>>> org.apache.webbeans.component.**AbstractOwbBean.create(** >>> AbstractOwbBean.java:181) >>> >>>> at >>>>> >>>>> org.apache.webbeans.context.**DependentContext.getInstance(** >>> DependentContext.java:70) >>> >>>> at >>>>> >>>> org.apache.webbeans.context.**AbstractContext.get(** >>> AbstractContext.java:132) >>> >>>> at >>>>> >>>>> org.apache.webbeans.container.**BeanManagerImpl.getReference(** >>> BeanManagerImpl.java:872) >>> >>>> at >>>>> >>>>> org.apache.webbeans.inject.**instance.InstanceImpl.get(** >>> InstanceImpl.java:126) >>> >>>> -- Mike Olson >>>>> >>>>> >>> -- >>> Mike Olson >>> >>> > > -- > Mike Olson > >
