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.JAXRSServerFactoryBean#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 <john.d.am...@gmail.com>: > 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/cxf/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 <rmannibu...@gmail.com> > 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 JAXRSCdiResourceExtensionWorkaround 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.setThreadDefaultBus(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.clearDefaultBusForAnyThread(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> > > >