From issues-return-39160-archive-asf-public=cust-asf.ponee.io@karaf.apache.org Tue Mar 20 17:13:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id E494918067E for ; Tue, 20 Mar 2018 17:13:03 +0100 (CET) Received: (qmail 40045 invoked by uid 500); 20 Mar 2018 16:13:03 -0000 Mailing-List: contact issues-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@karaf.apache.org Delivered-To: mailing list issues@karaf.apache.org Received: (qmail 39834 invoked by uid 99); 20 Mar 2018 16:13:03 -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; Tue, 20 Mar 2018 16:13:03 +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 8D85F180DE1 for ; Tue, 20 Mar 2018 16:13:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.311 X-Spam-Level: X-Spam-Status: No, score=-110.311 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled 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 BukRKAoM5P1V for ; Tue, 20 Mar 2018 16:13:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 064465F178 for ; Tue, 20 Mar 2018 16:13:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5BFBAE021E for ; Tue, 20 Mar 2018 16:13:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 1CFA4214BF for ; Tue, 20 Mar 2018 16:13:00 +0000 (UTC) Date: Tue, 20 Mar 2018 16:13:00 +0000 (UTC) From: "Boban Petkovic (JIRA)" To: issues@karaf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (KARAF-5674) Karaf 4.2.0 M2 class path issue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/KARAF-5674?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Boban Petkovic updated KARAF-5674: ---------------------------------- Description:=20 While migrating our application to work on karaf 4.2.0 (once it got release= d) I hit an issue with class loader while testing on karaf 4.2.0 M2. I will= try to explain it simple: Let say I have bundle A that contains REST endpoints (CXF 3.2.2). I use dos= gi to register CXF endpoints. From=C2=A0REST endpoint (in bundle A) we invo= ke some code from bundle B that uses=C2=A0aws-java-sdk-osgi bundle (version= 1.11.272). This fails with the error: javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFacto= ry not found The same code works on karaf 4.1.5 and karaf 4.0.7 that we use at the momen= t. After some investigation I figured out that the context of class loader = used to invoke the code from our bundles is=C2=A0org.apache.cxf.cxf-rt-tran= sports-http. When I tried something like this it worked fine: {code:java} ClassLoader tccl =3D Thread.currentThread() .getContextClassLoader(); Threa= d.currentThread().setContextClassLoader(this.getClass().getClassLoader()); AWS SDK calls that fails (from bundle B)=20 Thread.currentThread().setContextClassLoader(tccl);{code} Has something been changed when it comes to class loading mechanism in 4.2.= 0? While testing the same code on 4.1.5 I can see that the same context (or= g.apache.cxf.cxf-rt-transports-http) is used, but it works fine. was: While migrating our application to work on karaf 4.2.0 (once it got release= d) I hit an issue with class loader while testing on karaf 4.2.0 M2. I will= try to explain it simple: Let say I have bundle A that contains REST endpoints (CXF 3.2.2). I use dos= gi to register CXF endpoints. From=C2=A0REST endpoint (in bundle A) we invo= ke some code from bundle B that uses=C2=A0aws-java-sdk-osgi bundle (version= 1.11.272). This fails with the error: javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFacto= ry not found The same code works on karaf 4.1.5 and karaf 4.0.7 that we use at the momen= t. After some investigation I figured out that the context of class loader = used to invoke the code from our bundles is=C2=A0org.apache.cxf.cxf-rt-tran= sports-http. When I tried something like this it works fine: {code:java} ClassLoader tccl =3D Thread.currentThread() .getContextClassLoader(); Threa= d.currentThread().setContextClassLoader(this.getClass().getClassLoader()); AWS SDK calls that fails (from bundle B)=20 Thread.currentThread().setContextClassLoader(tccl);{code} Has something been changed when it comes to class loading mechanism in 4.2.= 0? While testing the same code on 4.1.5 I can see that the same context (or= g.apache.cxf.cxf-rt-transports-http) is used, but it works fine. > Karaf 4.2.0 M2 class path issue > ------------------------------- > > Key: KARAF-5674 > URL: https://issues.apache.org/jira/browse/KARAF-5674 > Project: Karaf > Issue Type: Bug > Components: karaf-osgi > Affects Versions: 4.2.0.M2 > Reporter: Boban Petkovic > Priority: Critical > > While migrating our application to work on karaf 4.2.0 (once it got relea= sed) I hit an issue with class loader while testing on karaf 4.2.0 M2. I wi= ll try to explain it simple: > Let say I have bundle A that contains REST endpoints (CXF 3.2.2). I use d= osgi to register CXF endpoints. From=C2=A0REST endpoint (in bundle A) we in= voke some code from bundle B that uses=C2=A0aws-java-sdk-osgi bundle (versi= on 1.11.272). This fails with the error: > javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFac= tory not found > The same code works on karaf 4.1.5 and karaf 4.0.7 that we use at the mom= ent. After some investigation I figured out that the context of class loade= r used to invoke the code from our bundles is=C2=A0org.apache.cxf.cxf-rt-tr= ansports-http. When I tried something like this it worked fine: > {code:java} > ClassLoader tccl =3D Thread.currentThread() .getContextClassLoader(); Thr= ead.currentThread().setContextClassLoader(this.getClass().getClassLoader())= ; > AWS SDK calls that fails (from bundle B)=20 > Thread.currentThread().setContextClassLoader(tccl);{code} > Has something been changed when it comes to class loading mechanism in 4.= 2.0? While testing the same code on 4.1.5 I can see that the same context (= org.apache.cxf.cxf-rt-transports-http) is used, but it works fine. -- This message was sent by Atlassian JIRA (v7.6.3#76005)