Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Won't Fix
-
1.4.0
-
None
-
None
-
Unknown
Description
When configuring Discovery with the Single-Bundle distribution a NoClassDefFoundError occurs and discovery does not start up.
To reproduce, place a org.apache.cxf.dosgi.discovery.zookeeper.cfg file in the load directory with the following content:
zookeeper.host = 127.0.0.1
When the CXF-DOSGi bundle is started the following error appears:
*ERROR* [org.osgi.service.cm.ManagedService, id=25, bundle=5]: Unexpected problem updating Configuration PID=org.apache.cxf.dosgi.discovery.zookeeper, factoryPID=null, bundleLocation=file:/Users/david/checkouts/cxf_dosgi_240113/distribution/single-bundle/target/cxf-dosgi-ri-singlebundle-distribution-1.5-SNAPSHOT.jar java.lang.NoClassDefFoundError: org/apache/log4j/Logger at org.apache.zookeeper.ZooKeeper.<clinit>(ZooKeeper.java:108) at org.apache.cxf.dosgi.discovery.zookeeper.ZooKeeperDiscovery.createZooKeeper(ZooKeeperDiscovery.java:111) at org.apache.cxf.dosgi.discovery.zookeeper.ZooKeeperDiscovery.updated(ZooKeeperDiscovery.java:72) at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1160) at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:104) at java.lang.Thread.run(Thread.java:680) Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger not found by cxf-dosgi-ri-singlebundle-distribution [5] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460) at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 6 more
While CXF-DOSGi has migrated to use SLF4J, the embedded zookeeper code still uses Log4J. Log4J is currently not provided in the single bundle distro nor marked as imported. The classloader manages to get access to it because of the Dynamic-ImportPackage=* which is present in the CXF-DOSGi Single-Bundle distro (yuck).
As the Single-Bundle distro is really about convenience, it should also provide the Log4J classes so that the discovery code will work without providing any additional bundles.
Attachments
Issue Links
- is related to
-
DOSGI-151 java.lang.NoClassDefFoundError: org/apache/log4j/Logger
- Resolved