karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boban Petkovic (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (KARAF-5674) Karaf 4.2.0 M2 class load issue
Date Thu, 29 Mar 2018 16:07:00 GMT

    [ https://issues.apache.org/jira/browse/KARAF-5674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16419255#comment-16419255
] 

Boban Petkovic edited comment on KARAF-5674 at 3/29/18 4:06 PM:
----------------------------------------------------------------

Hi [~gnt], I've just tried the snapshot from today (March 29th) and I hit another issue. cxf-dosgi
(2.3.0) does not work if cxf is installed (I tried cxf 3.2.0, 3.2.2 and 3.2.4 version). If
cxf is not installed, cxf-dosgi bundles work fine, they got activated. cxf and cxf-dosgi
work fine in karaf 4.2.0 M2. In the log I see the following error:
{code:java}
2018-03-29T17:54:46,652 | ERROR | paxweb-config-1-thread-1 | Activator | 166 - org.ops4j.pax.web.pax-web-runtime
- 7.0.0 | Unable to start pax web server: org/w3c/dom/ElementTraversal
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
 at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
 at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:?]
 at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2410)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2194)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1607)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80) ~[?:?]
 at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
~[?:?]
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
 at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source) ~[?:?]
 at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source) ~[?:?]
 at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source) ~[?:?]
 at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source) ~[?:?]
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[?:?]
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[?:?]
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[?:?]
 at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) ~[?:?]
 at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) ~[?:?]
 at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) ~[?:?]
 at org.ops4j.util.xml.ElementHelper.getRootElement(ElementHelper.java:103) ~[?:?]
 at org.ops4j.pax.web.service.internal.DefaultPropertyResolver.getDefaltProperties(DefaultPropertyResolver.java:59)
~[?:?]
 at org.ops4j.pax.web.service.internal.DefaultPropertyResolver.<init>(DefaultPropertyResolver.java:50)
~[?:?]
 at org.ops4j.pax.web.service.internal.Activator.updateController(Activator.java:339) ~[?:?]
 at org.ops4j.pax.web.service.internal.Activator.lambda$scheduleUpdateFactory$2(Activator.java:291)
~[?:?]
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
 at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
 at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
 at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:?]
 at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:?]
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
 at org.apache.felix.framework.ExtensionManager$ExtensionManagerWiring.getClassByDelegation(ExtensionManager.java:940)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1660)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1590)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80) ~[?:?]
 at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
~[?:?]
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
 ... 28 more{code}
I downloaded karaf 4.2.0 snapshot from [https://repository.apache.org/content/groups/snapshots-group/org/apache/karaf/apache-karaf/4.2.0-SNAPSHOT/]


was (Author: bobanbp):
Hi [~gnt], I've just tried the snapshot from today (March 29th) and I hit another issue. cxf-dosgi
(2.3.0) does not work if cxf is installed (I tried cxf 3.2.0, 3.2.2 and 3.2.4 version). If
cxf is not installed, cxf-dosgi bundles work fine, they got activated. In the log I see the
following error:
{code:java}
2018-03-29T17:54:46,652 | ERROR | paxweb-config-1-thread-1 | Activator | 166 - org.ops4j.pax.web.pax-web-runtime
- 7.0.0 | Unable to start pax web server: org/w3c/dom/ElementTraversal
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
 at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
 at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:?]
 at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2410)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2194)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1607)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80) ~[?:?]
 at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
~[?:?]
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
 at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source) ~[?:?]
 at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source) ~[?:?]
 at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source) ~[?:?]
 at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source) ~[?:?]
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[?:?]
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[?:?]
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[?:?]
 at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) ~[?:?]
 at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) ~[?:?]
 at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) ~[?:?]
 at org.ops4j.util.xml.ElementHelper.getRootElement(ElementHelper.java:103) ~[?:?]
 at org.ops4j.pax.web.service.internal.DefaultPropertyResolver.getDefaltProperties(DefaultPropertyResolver.java:59)
~[?:?]
 at org.ops4j.pax.web.service.internal.DefaultPropertyResolver.<init>(DefaultPropertyResolver.java:50)
~[?:?]
 at org.ops4j.pax.web.service.internal.Activator.updateController(Activator.java:339) ~[?:?]
 at org.ops4j.pax.web.service.internal.Activator.lambda$scheduleUpdateFactory$2(Activator.java:291)
~[?:?]
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
 at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
 at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
 at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:?]
 at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:?]
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
 at org.apache.felix.framework.ExtensionManager$ExtensionManagerWiring.getClassByDelegation(ExtensionManager.java:940)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1660)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1590)
~[?:?]
 at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80) ~[?:?]
 at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
~[?:?]
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
 ... 28 more{code}
I downloaded karaf 4.2.0 snapshot from https://repository.apache.org/content/groups/snapshots-group/org/apache/karaf/apache-karaf/4.2.0-SNAPSHOT/

> Karaf 4.2.0 M2 class load 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 released) 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 dosgi to register
CXF endpoints. From REST endpoint (in bundle A) we invoke some code from bundle B that uses aws-java-sdk-osgi
bundle (version 1.11.272). This fails with the error:
> javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory not found
> The same code works on karaf 4.1.5 and karaf 4.0.7 that we use at the moment. After some
investigation I figured out that the context of class loader used to invoke the code from
our bundles is org.apache.cxf.cxf-rt-transports-http. When I tried to set class loader to
use our bundle's context it worked fine:
> {code:java}
> ClassLoader tccl = Thread.currentThread() .getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
> AWS SDK calls that fails (from bundle B) 
> 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)

Mime
View raw message