Thanks for the merge, FYI I enhanced openwebbeans to be more tolerant of that case ( https://issues.apache.org/jira/browse/OWB-1157) but happy we work with "current" and older releases.
Thanks guys. Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> 2016-10-19 21:41 GMT+02:00 Romain Manni-Bucau <[email protected]>: > here it is https://github.com/apache/cxf/pull/181 > > > Romain Manni-Bucau > @rmannibucau <https://twitter.com/rmannibucau> | Blog > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog > <http://rmannibucau.wordpress.com> | Github > <https://github.com/rmannibucau> | LinkedIn > <https://www.linkedin.com/in/rmannibucau> | Tomitriber > <http://www.tomitribe.com> | JavaEE Factory > <https://javaeefactory-rmannibucau.rhcloud.com> > > 2016-10-19 20:28 GMT+02:00 John D. Ament <[email protected]>: > >> Could you raise a PR against 3.1.x? This way the PR builder runs and can >> test that there's no regression w/ Weld. >> >> John >> >> On Wed, Oct 19, 2016 at 2:03 PM Romain Manni-Bucau <[email protected] >> > >> wrote: >> >> > in the meantime if someone can apply my patch or equivalent and push a >> > 3.1.9-SNAPSHOT it would unblock us. >> > >> > >> > Romain Manni-Bucau >> > @rmannibucau <https://twitter.com/rmannibucau> | Blog >> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog >> > <http://rmannibucau.wordpress.com> | Github < >> > https://github.com/rmannibucau> | >> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber >> > <http://www.tomitribe.com> | JavaEE Factory >> > <https://javaeefactory-rmannibucau.rhcloud.com> >> > >> > 2016-10-19 19:48 GMT+02:00 John D. Ament <[email protected]>: >> > >> > > Yep I remember mark mentioned that to me before. Ok I need to >> prioritize >> > > getting those extra tests too. >> > > >> > > On Oct 19, 2016 13:29, "Romain Manni-Bucau" <[email protected]> >> > wrote: >> > > >> > > > @John: yes, didn't check weld but OWB wraps 3rd party Bean<?> (cxf >> bus >> > > > here) where weld doesn't probably. >> > > > >> > > > >> > > > Romain Manni-Bucau >> > > > @rmannibucau <https://twitter.com/rmannibucau> | Blog >> > > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog >> > > > <http://rmannibucau.wordpress.com> | Github <https://github.com/ >> > > > rmannibucau> | >> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber >> > > > <http://www.tomitribe.com> | JavaEE Factory >> > > > <https://javaeefactory-rmannibucau.rhcloud.com> >> > > > >> > > > 2016-10-19 19:19 GMT+02:00 John D. Ament <[email protected]>: >> > > > >> > > > > Ok this makes sense now. I suspect this is an internal diff >> between >> > > owb >> > > > > and weld (hence why i still want those tests). Thanks Roma! >> > > > > >> > > > > On Oct 19, 2016 13:16, "Romain Manni-Bucau" < >> [email protected]> >> > > > wrote: >> > > > > >> > > > > > http://svn.apache.org/repos/asf/openwebbeans/microwave/trunk/ >> just >> > > run >> > > > > > core >> > > > > > module >> > > > > > >> > > > > > Think the extension was written with Weld which behaves a bit >> > > > differently >> > > > > > from openwebbeans on that point. >> > > > > > >> > > > > > >> > > > > > Romain Manni-Bucau >> > > > > > @rmannibucau <https://twitter.com/rmannibucau> | Blog >> > > > > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog >> > > > > > <http://rmannibucau.wordpress.com> | Github < >> https://github.com/ >> > > > > > rmannibucau> | >> > > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber >> > > > > > <http://www.tomitribe.com> | JavaEE Factory >> > > > > > <https://javaeefactory-rmannibucau.rhcloud.com> >> > > > > > >> > > > > > 2016-10-19 19:08 GMT+02:00 Andrey Redko <[email protected]>: >> > > > > > >> > > > > > > Hey Roman, >> > > > > > > >> > > > > > > Thanks a lot for verifying. Would you mind to share the sample >> > > > project >> > > > > to >> > > > > > > reproduce the issue? >> > > > > > > There seems to be more things to take into account. >> > > > > > > Thanks. >> > > > > > > >> > > > > > > Best Regards, >> > > > > > > Andriy Redko >> > > > > > > >> > > > > > > On Wed, Oct 19, 2016 at 9:24 AM, Romain Manni-Bucau < >> > > > > > [email protected] >> > > > > > > > wrote: >> > > > > > > >> > > > > > >> doesn't work but for a weirder reason. >> > > > > > >> >> > > > > > >> CdiBean is added programmatically - all fine >> > > > > > >> >> > > > > > >> Then it is directly used to get the bus (in "use the default >> > bus" >> > > > > mode). >> > > > > > >> This is not really fine since the CDI impl is free to wrap >> this >> > so >> > > > you >> > > > > > >> should retrieve the actual instance of the bus and get it >> with >> > > this >> > > > > Bean >> > > > > > >> instance and not supposing the CDI container will return you >> the >> > > > > > instance >> > > > > > >> you added. >> > > > > > >> >> > > > > > >> Concretely here are the few fixes (on 3.1.x-fixes branch): >> > > > > > >> https://gist.github.com/rmannibucau/ >> > > 0bb8abf2e164d953be17b24b4a08e6 >> > > > 85 >> > > > > > >> >> > > > > > >> In CDI you can't assume equals/hashcode of Bean<?> so you >> need >> > to >> > > > > lookup >> > > > > > >> the bus instance and not use the internal one. This patch >> solves >> > > the >> > > > > > issue. >> > > > > > >> >> > > > > > >> >> > > > > > >> >> > > > > > >> >> > > > > > >> >> > > > > > >> Romain Manni-Bucau >> > > > > > >> @rmannibucau <https://twitter.com/rmannibucau> | Blog >> > > > > > >> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog >> > > > > > >> <http://rmannibucau.wordpress.com> | Github >> > > > > > >> <https://github.com/rmannibucau> | LinkedIn >> > > > > > >> <https://www.linkedin.com/in/rmannibucau> | Tomitriber >> > > > > > >> <http://www.tomitribe.com> | JavaEE Factory >> > > > > > >> <https://javaeefactory-rmannibucau.rhcloud.com> >> > > > > > >> >> > > > > > >> 2016-10-19 13:35 GMT+02:00 Andrey Redko <[email protected]>: >> > > > > > >> >> > > > > > >>> Hi Roman, >> > > > > > >>> >> > > > > > >>> Thanks a lot for clarifying on things. Could you please try >> > > latest >> > > > > > >>> 3.1.9-SNAPSHOT / 3.2.0-SNAPSHOT against this issue? >> > > > > > >>> The fix should be there. Thanks! >> > > > > > >>> >> > > > > > >>> Best Regards, >> > > > > > >>> Andriy Redko >> > > > > > >>> >> > > > > > >>> On Wed, Oct 19, 2016 at 2:28 AM, Romain Manni-Bucau < >> > > > > > >>> [email protected]> wrote: >> > > > > > >>> >> > > > > > >>>> Le 19 oct. 2016 04:14, "Andriy Redko" <[email protected]> a >> > > écrit >> > > > : >> > > > > > >>>> > >> > > > > > >>>> > I think this is what is happening: >> > > > > > >>>> > - Roman defines own CXF bus bean, named "cxf" >> > > > > > >>>> >> > > > > > >>>> This is a workaround to be able to lookup the bus in my >> > > workaround >> > > > > > >>>> extension. Not doing it without my extension leads to the >> > issue. >> > > > > > >>>> >> > > > > > >>>> > - our JAX-RS CDI extension finds it and makes it a >> > "default" >> > > > bus >> > > > > to >> > > > > > >>>> be used >> > > > > > >>>> > for JAXRSServerFactoryBean instances >> > > > > > >>>> > - however, JAXRSServerFactoryBean::setApplication() >> would >> > > > > create a >> > > > > > >>>> new bus >> > > > > > >>>> > nonetheless, because the actual call to >> > > > > > >>>> JAXRSServerFactoryBean::setBus would >> > > > > > >>>> > be done later >> > > > > > >>>> > >> > > > > > >>>> >> > > > > > >>>> This is the issue, custom bus or not. >> > > > > > >>>> >> > > > > > >>>> > The issue in this case is that application was created >> using >> > > one >> > > > > bus >> > > > > > >>>> instance, >> > > > > > >>>> > but JAXRSServerFactoryBean would be initialized using >> > another >> > > > bus >> > > > > > >>>> instance. This >> > > > > > >>>> > is my understading of the problem. Hopefully it makes >> sense. >> > > > > > >>>> > >> > > > > > >>>> >> > > > > > >>>> The factory uses the cdi bus but the application used a >> > > > "prototype" >> > > > > > bus. >> > > > > > >>>> >> > > > > > >>>> Side note: i deploy with tomcat embedded a single app so I >> am >> > > not >> > > > in >> > > > > > >>>> "multiple" deployments case. >> > > > > > >>>> >> > > > > > >>>> > Best Regards, >> > > > > > >>>> > Andriy Redko >> > > > > > >>>> > >> > > > > > >>>> > JDA> So still something isn't clicking as I don't have >> > > Romain's >> > > > > > >>>> issue. Is it >> > > > > > >>>> > JDA> specific to when you have multiple deployments in >> your >> > > JVM? >> > > > > > >>>> > >> > > > > > >>>> > JDA> On Oct 18, 2016 09:02, "Romain Manni-Bucau" < >> > > > > > >>>> [email protected]> wrote: >> > > > > > >>>> > >> > > > > > >>>> > >> 2016-10-18 14:43 GMT+02:00 Andrey Redko < >> > [email protected] >> > > >: >> > > > > > >>>> > >> > > > > > >>>> > >> > Hi Romain Manni-Bucau, >> > > > > > >>>> > >> > >> > > > > > >>>> > >> > Yes, technically we do have this option, but I would >> > > > suggest >> > > > > to >> > > > > > >>>> use >> > > > > > >>>> > >> > explicit wirings instead of thread local context. >> It >> > > > > > >>>> > >> > could have quite a number of side effects. I hope >> you >> > > would >> > > > > > >>>> agree with >> > > > > > >>>> > >> > that. >> > > > > > >>>> > >> > >> > > > > > >>>> > >> > >> > > > > > >>>> > >> I agree it is better but side effect should be null >> since >> > > the >> > > > > > >>>> value is >> > > > > > >>>> > >> cleaned up after. If not then runtime can have side >> > effects >> > > > > which >> > > > > > >>>> would be >> > > > > > >>>> > >> a bigger issue ;) >> > > > > > >>>> > >> > > > > > >>>> > >> > > > > > >>>> > >> > Thanks! >> > > > > > >>>> > >> > >> > > > > > >>>> > >> > Best Regards, >> > > > > > >>>> > >> > Andriy Redko >> > > > > > >>>> > >> > >> > > > > > >>>> > >> > >> > > > > > >>>> > >> > On Tue, Oct 18, 2016 at 7:49 AM, Romain Manni-Bucau >> < >> > > > > > >>>> > >> [email protected] >> > > > > > >>>> > >> > > >> > > > > > >>>> > >> > wrote: >> > > > > > >>>> > >> > >> > > > > > >>>> > >> > > We also have option 3: set the thread bus as in >> the >> > > > > > workaround >> > > > > > >>>> I used. >> > > > > > >>>> > >> > > >> > > > > > >>>> > >> > > >> > > > > > >>>> > >> > > Romain Manni-Bucau >> > > > > > >>>> > >> > > @rmannibucau <https://twitter.com/rmannibucau> | >> > Blog >> > > > > > >>>> > >> > > <https://blog-rmannibucau.rhcloud.com> | Old >> > Wordpress >> > > > > Blog >> > > > > > >>>> > >> > > <http://rmannibucau.wordpress.com> | Github < >> > > > > > >>>> https://github.com/ >> > > > > > >>>> > >> > > rmannibucau> | >> > > > > > >>>> > >> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> >> | >> > > > > > >>>> Tomitriber >> > > > > > >>>> > >> > > <http://www.tomitribe.com> | JavaEE Factory >> > > > > > >>>> > >> > > <https://javaeefactory-rmannibucau.rhcloud.com> >> > > > > > >>>> > >> > > >> > > > > > >>>> > >> > > 2016-10-18 13:47 GMT+02:00 Sergey Beryozkin < >> > > > > > >>>> [email protected]>: >> > > > > > >>>> > >> > > >> > > > > > >>>> > >> > > > Hi Andriy >> > > > > > >>>> > >> > > > yes, option 1 is probably the simplest for the >> CDI >> > > > > > >>>> integration path, >> > > > > > >>>> > >> > > > >> > > > > > >>>> > >> > > > Thanks, Sergey >> > > > > > >>>> > >> > > > >> > > > > > >>>> > >> > > > On 18/10/16 12:43, Andrey Redko wrote: >> > > > > > >>>> > >> > > > >> > > > > > >>>> > >> > > >> Hey guys, >> > > > > > >>>> > >> > > >> >> > > > > > >>>> > >> > > >> Indeed, there is an issue with CDI and usage of >> > > custom >> > > > > > bus. >> > > > > > >>>> I think >> > > > > > >>>> > >> > > there >> > > > > > >>>> > >> > > >> are couple of the options >> > > > > > >>>> > >> > > >> we have here: >> > > > > > >>>> > >> > > >> - pass the bus instance to ResourceUtils:: >> > > > > > createApplication, >> > > > > > >>>> in >> > > > > > >>>> > >> this >> > > > > > >>>> > >> > > >> case >> > > > > > >>>> > >> > > >> if bus is not set, the behaviour would be >> exactly >> > > the >> > > > > same >> > > > > > >>>> > >> > > >> - change the way JAXRSServerFactoryBean is >> being >> > > > > created >> > > > > > >>>> so we >> > > > > > >>>> > >> could >> > > > > > >>>> > >> > > set >> > > > > > >>>> > >> > > >> the bus before setting the application >> > > > > > >>>> > >> > > >> >> > > > > > >>>> > >> > > >> Romain Manni-Bucau, do we have a ticket for >> it? If >> > > > not, >> > > > > > >>>> could you >> > > > > > >>>> > >> > please >> > > > > > >>>> > >> > > >> create one, we'll work on a fix for it. >> > > > > > >>>> > >> > > >> Thanks. >> > > > > > >>>> > >> > > >> >> > > > > > >>>> > >> > > >> >> > > > > > >>>> > >> > > >> On Tue, Oct 18, 2016 at 7:08 AM, Romain >> > Manni-Bucau >> > > < >> > > > > > >>>> > >> > > >> [email protected]> >> > > > > > >>>> > >> > > >> wrote: >> > > > > > >>>> > >> > > >> >> > > > > > >>>> > >> > > >> Not yet something failling i can share but >> > globally >> > > I >> > > > > > ended >> > > > > > >>>> up doing >> > > > > > >>>> > >> > > that: >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> @Named("cxf") >> > > > > > >>>> > >> > > >>> @ApplicationScoped >> > > > > > >>>> > >> > > >>> public class BusInstance implements Bus { >> > > > > > >>>> > >> > > >>> @Delegate >> > > > > > >>>> > >> > > >>> private Bus delegate = new >> ExtensionManagerBus(); >> > > > > > >>>> > >> > > >>> } >> > > > > > >>>> > >> > > >>> public class OWBAutoSetup implements >> > > > > > >>>> ServletContainerInitializer { >> > > > > > >>>> > >> > > >>> @Override >> > > > > > >>>> > >> > > >>> public void onStartup(final Set<Class<?>> c, >> > final >> > > > > > >>>> ServletContext >> > > > > > >>>> > >> > ctx) >> > > > > > >>>> > >> > > >>> throws ServletException { >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> ctx.addListener(WebBeansConfig >> urationListener. >> > > > class); >> > > > > > >>>> > >> > > >>> ctx.addListener(WebBeansConfig >> > > > > > >>>> urationHttpSessionListener.class); >> > > > > > >>>> > >> > > >>> } >> > > > > > >>>> > >> > > >>> } >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> public class CxfCdiAutoSetup implements >> > > > > > >>>> > >> ServletContainerInitializer { >> > > > > > >>>> > >> > > >>> @Override >> > > > > > >>>> > >> > > >>> public void onStartup(final Set<Class<?>> c, >> > final >> > > > > > >>>> ServletContext >> > > > > > >>>> > >> > ctx) >> > > > > > >>>> > >> > > >>> throws ServletException { >> > > > > > >>>> > >> > > >>> final ServletRegistration.Dynamic jaxrs = >> > > > > > >>>> ctx.addServlet("cxf-cdi", >> > > > > > >>>> > >> > > >>> CXFCdiServlet.class); >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> jaxrs.setLoadOnStartup(1); >> > > > > > >>>> > >> > > >>> jaxrs.setAsyncSupported(true); >> > > > > > >>>> > >> > > >>> jaxrs.addMapping("/*"); // TODO: config >> > > > > > >>>> > >> > > >>> } >> > > > > > >>>> > >> > > >>> } >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> With my workaround extension it works fine, >> > without >> > > > > there >> > > > > > >>>> is this >> > > > > > >>>> > >> > > >>> mismatch >> > > > > > >>>> > >> > > >>> of bus. >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> Have to admit I have no idea how >> > > > > > >>>> > >> > > >>> org.apache.cxf.jaxrs.utils.Res >> > > > > > >>>> ourceUtils#createApplication( >> > > > > > >>>> > >> > javax.ws.rs >> > > > > > >>>> > >> > > . >> > > > > > >>>> > >> > > >>> core.Application, >> > > > > > >>>> > >> > > >>> boolean, boolean) could reuse the right bus in >> > > > current >> > > > > > >>>> state of the >> > > > > > >>>> > >> > cdi >> > > > > > >>>> > >> > > >>> module. If you check >> > > > > > >>>> > >> > > >>> org.apache.cxf.cdi.JAXRSCdiRes >> > > > > > >>>> ourceExtension#createFactoryIn >> > > > > > >>>> > >> > > >>> stance(javax. >> > > > > > >>>> > >> > > >>> ws.rs.core.Application, >> > > > > > >>>> > >> > > >>> java.util.List<?>, java.util.List<?>, >> > > > java.util.List<? >> > > > > > >>>> extends >> > > > > > >>>> > >> > > >>> org.apache.cxf.feature.Feature>) the bus is >> set >> > > but >> > > > > too >> > > > > > >>>> late >> > > > > > >>>> > >> (after >> > > > > > >>>> > >> > > bean >> > > > > > >>>> > >> > > >>> .setApplication(app);). >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> Romain Manni-Bucau >> > > > > > >>>> > >> > > >>> @rmannibucau <https://twitter.com/rmannibucau> >> | >> > > > Blog >> > > > > > >>>> > >> > > >>> <https://blog-rmannibucau.rhcloud.com> | Old >> > > > Wordpress >> > > > > > >>>> Blog >> > > > > > >>>> > >> > > >>> <http://rmannibucau.wordpress.com> | Github < >> > > > > > >>>> https://github.com/ >> > > > > > >>>> > >> > > >>> rmannibucau> | >> > > > > > >>>> > >> > > >>> LinkedIn < >> > https://www.linkedin.com/in/rmannibucau> >> > > | >> > > > > > >>>> Tomitriber >> > > > > > >>>> > >> > > >>> <http://www.tomitribe.com> | JavaEE Factory >> > > > > > >>>> > >> > > >>> <https://javaeefactory-rmannib >> ucau.rhcloud.com> >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> 2016-10-18 12:50 GMT+02:00 John D. Ament < >> > > > > > >>>> [email protected]>: >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>> Do you have a sample project that demonstrates >> > the >> > > > > issue? >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>>> Also, do you see setBus method being called >> on >> > > > > > >>>> CXFCdiServlet? How >> > > > > > >>>> > >> > > many >> > > > > > >>>> > >> > > >>>> times do you see it invoked? Maybe step >> through >> > > > > loadBus >> > > > > > >>>> to see >> > > > > > >>>> > >> > which >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>> path >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>>> it follows. >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>>> On Tue, Oct 18, 2016 at 6:24 AM Romain >> > > Manni-Bucau < >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>> [email protected]> >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>>> wrote: >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>>> Not really, >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>>> I don't have any bus bean, just using the >> > default >> > > > one >> > > > > > of >> > > > > > >>>> the >> > > > > > >>>> > >> > > extenson - >> > > > > > >>>> > >> > > >>>>> behavior is the same however if I impl my >> own >> > bus >> > > > > bean. >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>>> Issue is in the load() method of the >> extension. >> > > It >> > > > > gets >> > > > > > >>>> the bus >> > > > > > >>>> > >> and >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>> then >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>>> calls ResourceUtils. >> > > createApplication(application, >> > > > > > >>>> false, false) >> > > > > > >>>> > >> > > which >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>> will >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>>>> call org.apache.cxf.jaxrs.JAXRSServ >> > > > > > >>>> erFactoryBean#setApplication >> > > > > > >>>> > >> > > which >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>> will >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>>>> do getBus() wich uses BusFactory. >> > > > > getThreadDefaultBus() >> > > > > > >>>> which is >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>> obviously >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>>>> not set so you end up in >> > > org.apache.cxf.BusFactory# >> > > > > > >>>> > >> createThreadBus >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>> which >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>>> does a newInstance().createBus() and here you >> > are, >> > > > you >> > > > > > >>>> have 2 >> > > > > > >>>> > >> > > instances >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>> of >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>>>> a bus. >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>>> Romain >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>>> 2016-10-18 12:10 GMT+02:00 John D. Ament < >> > > > > > >>>> [email protected] >> > > > > > >>>> > >> >: >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>>> Romain, >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>>> Depends on how you're trying to instantiate >> > it. >> > > > > There >> > > > > > >>>> is a >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>> CdiBusBean >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>>> provided by CXF which does what you're >> trying to >> > > do >> > > > - >> > > > > > >>>> > >> > > >>>>>> https://github.com/apache/cxf/ >> > > > > > >>>> blob/3.1.x-fixes/integration/ >> > > > > > >>>> > >> > > >>>>>> cdi/src/main/java/org/apache/c >> > > > > > >>>> xf/cdi/CdiBusBean.java#L40 >> > > > > > >>>> > >> > > >>>>>> , >> > > > > > >>>> > >> > > >>>>>> take a look at the create method. >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>>> I was actually contemplating removing the >> > > @Inject >> > > > > from >> > > > > > >>>> the >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>> CXFCdiServlet's >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>>>> set method, it seems to work >> inconsistently. >> > > > > However, >> > > > > > >>>> i suspect >> > > > > > >>>> > >> > > that >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>> your >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>>>> issue is that you're getting a Bus >> registered >> > > as a >> > > > > > >>>> valid CDI >> > > > > > >>>> > >> bean >> > > > > > >>>> > >> > > >>>>>> (bean-discovery-mode=all?). >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>>> John >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>>> On Tue, Oct 18, 2016 at 5:58 AM Romain >> > > > Manni-Bucau < >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>> [email protected]> >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>>>> wrote: >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>>> Hi guys, >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>>> in cdi-integration I don't get how the >> > > deployment >> > > > > can >> > > > > > >>>> work >> > > > > > >>>> > >> cause >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>> the >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>>> thread >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>>>> local bus is not set >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>>> Here what i did to ensure i use a single >> bus >> > > (and >> > > > > > >>>> prevented the >> > > > > > >>>> > >> > cxf >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>> one >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>>>> to >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>>>> run): >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>>> public class >> JAXRSCdiResourceExtensionWorka >> > > round >> > > > > > >>>> extends >> > > > > > >>>> > >> > > >>>>>>> JAXRSCdiResourceExtension { >> > > > > > >>>> > >> > > >>>>>>> @Override >> > > > > > >>>> > >> > > >>>>>>> public void load(@Observes final >> > > > > > >>>> AfterDeploymentValidation >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>> event, >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>>> final BeanManager beanManager) { >> > > > > > >>>> > >> > > >>>>>>> final Bus bus = >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>>> Bus.class.cast(beanManager. >> > > > > getReference(beanManager. >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>> resolve(beanManager.getBeans(Bus.class)), >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>>>> Bus.class, null)); >> > > > > > >>>> > >> > > >>>>>>> BusFactory.setThreadDefaultBu >> s(bus); >> > > // >> > > > > > cause >> > > > > > >>>> app >> > > > > > >>>> > >> class >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>> will >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>>> rely on that and would create multiple bus >> and >> > > then >> > > > > > >>>> deployment >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>> would >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>>> be broken >> > > > > > >>>> > >> > > >>>>>>> try { >> > > > > > >>>> > >> > > >>>>>>> super.load(event, >> beanManager); >> > > > > > >>>> > >> > > >>>>>>> } finally { >> > > > > > >>>> > >> > > >>>>>>> BusFactory.clearDefaultBusFor >> > > > > > >>>> AnyThread(bus); >> > > > > > >>>> > >> > > >>>>>>> } >> > > > > > >>>> > >> > > >>>>>>> } >> > > > > > >>>> > >> > > >>>>>>> } >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>>> Issue was caused by >> > JAXRSCdiResourceExtension# >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>> createFactoryInstance >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >>>> which >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>>>> calls ResourceUtils.createApplication >> which >> > > uses >> > > > > the >> > > > > > >>>> thread >> > > > > > >>>> > >> bus >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>> which >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>>>> is >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>>>> not set by the extension leading to 2 >> buses. >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>>> Did I miss something? >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>>> Romain Manni-Bucau >> > > > > > >>>> > >> > > >>>>>>> @rmannibucau < >> > https://twitter.com/rmannibucau> >> > > | >> > > > > > Blog >> > > > > > >>>> > >> > > >>>>>>> <https://blog-rmannibucau.rhcloud.com> | >> Old >> > > > > > >>>> Wordpress Blog >> > > > > > >>>> > >> > > >>>>>>> <http://rmannibucau.wordpress.com> | >> Github >> > < >> > > > > > >>>> > >> > > >>>>>>> https://github.com/rmannibucau> | >> > > > > > >>>> > >> > > >>>>>>> LinkedIn <https://www.linkedin.com/in/ >> > > > rmannibucau> >> > > > > | >> > > > > > >>>> > >> Tomitriber >> > > > > > >>>> > >> > > >>>>>>> <http://www.tomitribe.com> | JavaEE >> Factory >> > > > > > >>>> > >> > > >>>>>>> < >> > https://javaeefactory-rmannibucau.rhcloud.com >> > > > >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>>> >> > > > > > >>>> > >> > > >>>>>> >> > > > > > >>>> > >> > > >>>>> >> > > > > > >>>> > >> > > >>>> >> > > > > > >>>> > >> > > >>> >> > > > > > >>>> > >> > > >> >> > > > > > >>>> > >> > > > >> > > > > > >>>> > >> > > > -- >> > > > > > >>>> > >> > > > Sergey Beryozkin >> > > > > > >>>> > >> > > > >> > > > > > >>>> > >> > > > Talend Community Coders >> > > > > > >>>> > >> > > > http://coders.talend.com/ >> > > > > > >>>> > >> > > > >> > > > > > >>>> > >> > > >> > > > > > >>>> > >> > >> > > > > > >>>> > >> > > > > > >>>> > >> > > > > > >>>> >> > > > > > >>> >> > > > > > >>> >> > > > > > >> >> > > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > >> > >
