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 A639E200BA6 for ; Tue, 18 Oct 2016 12:10:39 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A50A6160ADC; Tue, 18 Oct 2016 10:10:39 +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 EBB36160ACC for ; Tue, 18 Oct 2016 12:10:38 +0200 (CEST) Received: (qmail 79326 invoked by uid 500); 18 Oct 2016 10:10:38 -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 79313 invoked by uid 99); 18 Oct 2016 10:10:37 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Oct 2016 10:10:37 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 23445C083C for ; Tue, 18 Oct 2016 10:10:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-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: spamd1-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 (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id mZpsisAZgbPy for ; Tue, 18 Oct 2016 10:10:33 +0000 (UTC) Received: from mail-yw0-f175.google.com (mail-yw0-f175.google.com [209.85.161.175]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 641715FBD6 for ; Tue, 18 Oct 2016 10:10:33 +0000 (UTC) Received: by mail-yw0-f175.google.com with SMTP id t193so134304423ywc.2 for ; Tue, 18 Oct 2016 03:10:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=6DxUtJUTLGlTaoqd+Vg8uu0OWAedYuIGjjh5XRPkZHM=; b=gHOJQ8CXYLpcDovDeAbNK8lXu/p4QzgqjvvZyx3gOnm1t2sJCFF/ECf8Ktg3emmGjC ALuuiRjiHlJnw/h5wqT766midtdC5XRhDNR+qb8Tv1d39M93Ih77D3DuOT4sa/zFGv6z AFwd46/oe7GZFOfsmjwXt2JMmZ90dwYzBm3vN68k6K2lHN9LxP09DU+hOdcsE3N/uRQ+ ysE1YjMkShsuaH//DoKTqckOvGmr4zsrg4AGIJVzeKutlmtYOrqBl52x12Ln0+NtRj4Z /rT9dqHE2lxSkPyF2jofm2+pXpLYMdqVXEmxNvBxgOtDPZ4758TsMd9lR3e5nYED5LJw yylA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=6DxUtJUTLGlTaoqd+Vg8uu0OWAedYuIGjjh5XRPkZHM=; b=CalT8UeDODTwQgtbaqMitcN4e7EIXneqF3xAyeuZ/H1XX4ClTE7LKHqP8/EFuCe3LK k8zyJUGRf3weFpTvfnuNwK0kmBS4MKiNJbpRTK/LwKUwhyiIBZtIjWDiEXj/0m7nJ/Jl oGJ1RSOcRthsNQ0VN+Hj54Jf3ow++4fTTo8Ue2K6pzVUEAP/3NDKVPqT2voPnqPHQzvF NdBDLEgg50g31W5ex6iltNgagTM9ig7YT0K29/P70JXMOuEGkhrlnEycProrkmaSaRaV +3lAgVtahlwlJCYdwgR77NLPWYa3ASjUTbmN4K/qE89iFNIPLnZkex2xMEhDdZfcjyaz AlhA== X-Gm-Message-State: AA6/9Rm56Y01udk56YfALfzAMQ1EZXP6FHQmQjY4yBeV8RvXiG5AcvwWJpGAH1p9JWuI2v+OtiMxpW0W0T5YgA== X-Received: by 10.13.243.5 with SMTP id c5mr1917244ywf.137.1476785429771; Tue, 18 Oct 2016 03:10:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "John D. Ament" Date: Tue, 18 Oct 2016 10:10:18 +0000 Message-ID: Subject: Re: cxi integration: multiple buses during deployment? To: dev@cxf.apache.org Content-Type: multipart/alternative; boundary=94eb2c035078f3b6b0053f20e6a3 archived-at: Tue, 18 Oct 2016 10:10:39 -0000 --94eb2c035078f3b6b0053f20e6a3 Content-Type: text/plain; charset=UTF-8 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 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 | Blog > | Old Wordpress Blog > | Github < > https://github.com/rmannibucau> | > LinkedIn | Tomitriber > | JavaEE Factory > > --94eb2c035078f3b6b0053f20e6a3--