Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id ECEA6200BA5 for ; Wed, 19 Oct 2016 21:42:32 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EB6D9160AEA; Wed, 19 Oct 2016 19:42:32 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 72CE8160ADC for ; Wed, 19 Oct 2016 21:42:31 +0200 (CEST) Received: (qmail 65436 invoked by uid 500); 19 Oct 2016 19:42:30 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Received: (qmail 65378 invoked by uid 99); 19 Oct 2016 19:42:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Oct 2016 19:42:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id D9BD51804FC for ; Wed, 19 Oct 2016 19:42:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id eCrUxaYGS__X for ; Wed, 19 Oct 2016 19:42:20 +0000 (UTC) Received: from mail-qk0-f178.google.com (mail-qk0-f178.google.com [209.85.220.178]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 62BFF5F486 for ; Wed, 19 Oct 2016 19:42:20 +0000 (UTC) Received: by mail-qk0-f178.google.com with SMTP id f128so52681736qkb.1 for ; Wed, 19 Oct 2016 12:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4mNLonBZ4zUBIwDeylW/UI62QIZ5e0fCw8C+iL+Wq9U=; b=LS5vM2/gdeuyhbMLAEJv4/n6SyzOqZ6TE7RPzWkDEZXZKmOZXt/kjkz2eeNnmRlQBI BqeDPczHQMztNPCQ12YREdrzyqS0eJhxfeuKrNsVV1Gh1px0oLmUfiQspfHAKl9mTVQi zRzZnRTwGas1fyFPBvS21fX5I+glBrqvVFvvZne0EZSqkjBJhNsdX7OKz2YGf9e3rr1M f060rQ6uV1LOsqE8L13GJTHi78iMX7A5/KkZJVA8ItlWsZ8Uj/rkLTiUex0SDLTBv7Mv atCErSMMthpYpfPgWNNSagHbKYqQNnk6dlxpotT6W40hOMbofb0LEN3vV1JwbNS3+Ah5 semw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4mNLonBZ4zUBIwDeylW/UI62QIZ5e0fCw8C+iL+Wq9U=; b=KLOBimqY9ONRzbZ6JnpzKWrGioiTDsX83cs/b8mCBU2pj2sCXd11mUyX5+/ocqtqEP NS71YEsXb9GU7jI9baBMaDYTvPMa/NU4eKfA4Toc//JV712WHO5q2T0JvD51V4QQeMUa xfAVjfdJybqOupKYkn0o5GZYOzX5ZaQPCy60hS0BJFYeRqlcmDPp9A5MCTBk0YDYGmvj uk1BAMVAw8NTVHpZA1Jk5tevzmQ5jHqfI5Z+XtIeEeMGP4Kr29oXj9C5fY5C4kguKJ3x PN8QANXnmMHQlKkUaHHZnwyqSawbzNFH/8YLFTtBA98k5FPoMLwo76fr4KBIkGGcrY5E K38Q== X-Gm-Message-State: AA6/9Rk+XPlrldjgm3Lucx3qf4KZoSYDqewWLthiKl+YiDfUqEPLPQS6a7g2EqmS/l79gO9F3cz8lU3ru1+slA== X-Received: by 10.194.148.146 with SMTP id ts18mr5281863wjb.91.1476906138817; Wed, 19 Oct 2016 12:42:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.110.73 with HTTP; Wed, 19 Oct 2016 12:41:57 -0700 (PDT) In-Reply-To: References: <30e2470a-2f14-8d56-8902-a7f4b7b3f18a@gmail.com> <1666042994.20161018221403@gmail.com> From: Romain Manni-Bucau Date: Wed, 19 Oct 2016 21:41:57 +0200 Message-ID: Subject: Re: cxi integration: multiple buses during deployment? To: "dev@cxf.apache.org" Cc: Andriy Redko Content-Type: multipart/alternative; boundary=089e012289dec55cbf053f3d01b7 archived-at: Wed, 19 Oct 2016 19:42:33 -0000 --089e012289dec55cbf053f3d01b7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable here it is https://github.com/apache/cxf/pull/181 Romain Manni-Bucau @rmannibucau | Blog | Old Wordpress Blog | Github | LinkedIn | Tomitriber | JavaEE Factory 2016-10-19 20:28 GMT+02:00 John D. Ament : > 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 > 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 | Blog > > | Old Wordpress Blog > > | Github < > > https://github.com/rmannibucau> | > > LinkedIn | Tomitriber > > | JavaEE Factory > > > > > > 2016-10-19 19:48 GMT+02:00 John D. Ament : > > > > > 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" > > 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 | Blog > > > > | Old Wordpress Blog > > > > | Github > > > rmannibucau> | > > > > LinkedIn | Tomitriber > > > > | JavaEE Factory > > > > > > > > > > > > 2016-10-19 19:19 GMT+02:00 John D. Ament : > > > > > > > > > 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" > > > > > 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 | Blog > > > > > > | Old Wordpress Blog > > > > > > | Github > > > > > rmannibucau> | > > > > > > LinkedIn | Tomitriber > > > > > > | JavaEE Factory > > > > > > > > > > > > > > > > > > 2016-10-19 19:08 GMT+02:00 Andrey Redko : > > > > > > > > > > > > > Hey Roman, > > > > > > > > > > > > > > Thanks a lot for verifying. Would you mind to share the sampl= e > > > > 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 < > > > > > > rmannibucau@gmail.com > > > > > > > > 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 wi= th > > > 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 ne= ed > > to > > > > > lookup > > > > > > >> the bus instance and not use the internal one. This patch > solves > > > the > > > > > > issue. > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> Romain Manni-Bucau > > > > > > >> @rmannibucau | Blog > > > > > > >> | Old Wordpress Blog > > > > > > >> | Github > > > > > > >> | LinkedIn > > > > > > >> | Tomitriber > > > > > > >> | JavaEE Factory > > > > > > >> > > > > > > >> > > > > > > >> 2016-10-19 13:35 GMT+02:00 Andrey Redko : > > > > > > >> > > > > > > >>> 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 < > > > > > > >>> rmannibucau@gmail.com> wrote: > > > > > > >>> > > > > > > >>>> Le 19 oct. 2016 04:14, "Andriy Redko" a > > > =C3=A9crit > > > > : > > > > > > >>>> > > > > > > > >>>> > 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" < > > > > > > >>>> rmannibucau@gmail.com> wrote: > > > > > > >>>> > > > > > > > >>>> > >> 2016-10-18 14:43 GMT+02:00 Andrey Redko < > > drreta@gmail.com > > > >: > > > > > > >>>> > > > > > > > >>>> > >> > Hi Romain Manni-Bucau, > > > > > > >>>> > >> > > > > > > > >>>> > >> > Yes, technically we do have this option, but I woul= d > > > > suggest > > > > > to > > > > > > >>>> use > > > > > > >>>> > >> > explicit wirings instead of thread local context. = It > > > > > > >>>> > >> > could have quite a number of side effects. I hope y= ou > > > 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= < > > > > > > >>>> > >> rmannibucau@gmail.com > > > > > > >>>> > >> > > > > > > > > >>>> > >> > wrote: > > > > > > >>>> > >> > > > > > > > >>>> > >> > > We also have option 3: set the thread bus as in t= he > > > > > > workaround > > > > > > >>>> I used. > > > > > > >>>> > >> > > > > > > > > >>>> > >> > > > > > > > > >>>> > >> > > Romain Manni-Bucau > > > > > > >>>> > >> > > @rmannibucau | > > Blog > > > > > > >>>> > >> > > | Old > > Wordpress > > > > > Blog > > > > > > >>>> > >> > > | Github < > > > > > > >>>> https://github.com/ > > > > > > >>>> > >> > > rmannibucau> | > > > > > > >>>> > >> > > LinkedIn > | > > > > > > >>>> Tomitriber > > > > > > >>>> > >> > > | JavaEE Factory > > > > > > >>>> > >> > > > > > > > > >>>> > >> > > > > > > > > >>>> > >> > > 2016-10-18 13:47 GMT+02:00 Sergey Beryozkin < > > > > > > >>>> sberyozkin@gmail.com>: > > > > > > >>>> > >> > > > > > > > > >>>> > >> > > > 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 o= f > > > 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 > > > < > > > > > > >>>> > >> > > >> rmannibucau@gmail.com> > > > > > > >>>> > >> > > >> 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 =3D new > ExtensionManagerBus(); > > > > > > >>>> > >> > > >>> } > > > > > > >>>> > >> > > >>> public class OWBAutoSetup implements > > > > > > >>>> ServletContainerInitializer { > > > > > > >>>> > >> > > >>> @Override > > > > > > >>>> > >> > > >>> public void onStartup(final Set> c, > > final > > > > > > >>>> ServletContext > > > > > > >>>> > >> > ctx) > > > > > > >>>> > >> > > >>> throws ServletException { > > > > > > >>>> > >> > > >>> > > > > > > >>>> > >> > > >>> ctx.addListener(WebBeansConfigurationListener= . > > > > class); > > > > > > >>>> > >> > > >>> ctx.addListener(WebBeansConfig > > > > > > >>>> urationHttpSessionListener.class); > > > > > > >>>> > >> > > >>> } > > > > > > >>>> > >> > > >>> } > > > > > > >>>> > >> > > >>> > > > > > > >>>> > >> > > >>> > > > > > > >>>> > >> > > >>> > > > > > > >>>> > >> > > >>> public class CxfCdiAutoSetup implements > > > > > > >>>> > >> ServletContainerInitializer { > > > > > > >>>> > >> > > >>> @Override > > > > > > >>>> > >> > > >>> public void onStartup(final Set> c, > > final > > > > > > >>>> ServletContext > > > > > > >>>> > >> > ctx) > > > > > > >>>> > >> > > >>> throws ServletException { > > > > > > >>>> > >> > > >>> final ServletRegistration.Dynamic jaxrs =3D > > > > > > >>>> 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 i= n > > > > 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 > | > > > > Blog > > > > > > >>>> > >> > > >>> | Old > > > > Wordpress > > > > > > >>>> Blog > > > > > > >>>> > >> > > >>> | Github < > > > > > > >>>> https://github.com/ > > > > > > >>>> > >> > > >>> rmannibucau> | > > > > > > >>>> > >> > > >>> LinkedIn < > > https://www.linkedin.com/in/rmannibucau> > > > | > > > > > > >>>> Tomitriber > > > > > > >>>> > >> > > >>> | JavaEE Factory > > > > > > >>>> > >> > > >>> > > > > > > > >>>> > >> > > >>> > > > > > > >>>> > >> > > >>> 2016-10-18 12:50 GMT+02:00 John D. Ament < > > > > > > >>>> johndament@apache.org>: > > > > > > >>>> > >> > > >>> > > > > > > >>>> > >> > > >>> Do you have a sample project that demonstrate= s > > 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 < > > > > > > >>>> > >> > > >>>> > > > > > > >>>> > >> > > >>> rmannibucau@gmail.com> > > > > > > >>>> > >> > > >>> > > > > > > >>>> > >> > > >>>> 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 o= wn > > 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 yo= u > > are, > > > > you > > > > > > >>>> have 2 > > > > > > >>>> > >> > > instances > > > > > > >>>> > >> > > >>>>> > > > > > > >>>> > >> > > >>>> of > > > > > > >>>> > >> > > >>>> > > > > > > >>>> > >> > > >>>>> a bus. > > > > > > >>>> > >> > > >>>>> > > > > > > >>>> > >> > > >>>>> Romain > > > > > > >>>> > >> > > >>>>> > > > > > > >>>> > >> > > >>>>> 2016-10-18 12:10 GMT+02:00 John D. Ament < > > > > > > >>>> john.d.ament@gmail.com > > > > > > >>>> > >> >: > > > > > > >>>> > >> > > >>>>> > > > > > > >>>> > >> > > >>>>> Romain, > > > > > > >>>> > >> > > >>>>>> > > > > > > >>>> > >> > > >>>>>> Depends on how you're trying to instantiat= e > > it. > > > > > There > > > > > > >>>> is a > > > > > > >>>> > >> > > >>>>>> > > > > > > >>>> > >> > > >>>>> CdiBusBean > > > > > > >>>> > >> > > >>> > > > > > > >>>> > >> > > >>>> provided by CXF which does what you're tryin= g > 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 inconsistentl= y. > > > > > However, > > > > > > >>>> i suspect > > > > > > >>>> > >> > > that > > > > > > >>>> > >> > > >>>>>> > > > > > > >>>> > >> > > >>>>> your > > > > > > >>>> > >> > > >>>>> > > > > > > >>>> > >> > > >>>>>> issue is that you're getting a Bus > registered > > > as a > > > > > > >>>> valid CDI > > > > > > >>>> > >> bean > > > > > > >>>> > >> > > >>>>>> (bean-discovery-mode=3Dall?). > > > > > > >>>> > >> > > >>>>>> > > > > > > >>>> > >> > > >>>>>> John > > > > > > >>>> > >> > > >>>>>> > > > > > > >>>> > >> > > >>>>>> On Tue, Oct 18, 2016 at 5:58 AM Romain > > > > Manni-Bucau < > > > > > > >>>> > >> > > >>>>>> > > > > > > >>>> > >> > > >>>>> rmannibucau@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 JAXRSCdiResourceExtensionWor= ka > > > round > > > > > > >>>> extends > > > > > > >>>> > >> > > >>>>>>> JAXRSCdiResourceExtension { > > > > > > >>>> > >> > > >>>>>>> @Override > > > > > > >>>> > >> > > >>>>>>> public void load(@Observes final > > > > > > >>>> AfterDeploymentValidation > > > > > > >>>> > >> > > >>>>>>> > > > > > > >>>> > >> > > >>>>>> event, > > > > > > >>>> > >> > > >>> > > > > > > >>>> > >> > > >>>> final BeanManager beanManager) { > > > > > > >>>> > >> > > >>>>>>> final Bus bus =3D > > > > > > >>>> > >> > > >>>>>>> > > > > > > >>>> > >> > > >>>>>>> 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 a= nd > > > 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 buse= s. > > > > > > >>>> > >> > > >>>>>>> > > > > > > >>>> > >> > > >>>>>>> Did I miss something? > > > > > > >>>> > >> > > >>>>>>> > > > > > > >>>> > >> > > >>>>>>> Romain Manni-Bucau > > > > > > >>>> > >> > > >>>>>>> @rmannibucau < > > https://twitter.com/rmannibucau> > > > | > > > > > > Blog > > > > > > >>>> > >> > > >>>>>>> | > Old > > > > > > >>>> Wordpress Blog > > > > > > >>>> > >> > > >>>>>>> | > Github > > < > > > > > > >>>> > >> > > >>>>>>> https://github.com/rmannibucau> | > > > > > > >>>> > >> > > >>>>>>> LinkedIn > > > rmannibucau> > > > > > | > > > > > > >>>> > >> Tomitriber > > > > > > >>>> > >> > > >>>>>>> | JavaEE > Factory > > > > > > >>>> > >> > > >>>>>>> < > > https://javaeefactory-rmannibucau.rhcloud.com > > > > > > > > > > >>>> > >> > > >>>>>>> > > > > > > >>>> > >> > > >>>>>>> > > > > > > >>>> > >> > > >>>>>> > > > > > > >>>> > >> > > >>>>> > > > > > > >>>> > >> > > >>>> > > > > > > >>>> > >> > > >>> > > > > > > >>>> > >> > > >> > > > > > > >>>> > >> > > > > > > > > > >>>> > >> > > > -- > > > > > > >>>> > >> > > > Sergey Beryozkin > > > > > > >>>> > >> > > > > > > > > > >>>> > >> > > > Talend Community Coders > > > > > > >>>> > >> > > > http://coders.talend.com/ > > > > > > >>>> > >> > > > > > > > > > >>>> > >> > > > > > > > > >>>> > >> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > >>> > > > > > > >>> > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > --089e012289dec55cbf053f3d01b7--