[2.3.0] NoClassDefFoundError (wrong name: ...)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[2.3.0] NoClassDefFoundError (wrong name: ...)

barnesjd
Hey guys, I've hit a strange class loading error while trying to deploy a web archive in Karaf 2.3.0.  I'm new to OSGi in general.  I've experienced a lot of success deploying jars, but I've yet to succeed with a wab deployment.  I have all of my dependencies deployed, and the war service is active.  But it seems that it's choking on the contents of one of my dependencies.  

My wab is the Scalatra helloworld application.  I doctored the MANIFEST.MF to be OSGi-ready.  While the helloworld works great as a standalone application, I get the error below in my karaf.log while starting it as an OSGi bundle.  Please share any insight you may have into this type of error.  Thanks!

(FYI, if this story sounds a little familiar, you may have read my previous post.)

java.lang.NoClassDefFoundError: org/scalatra/servlet/ScalatraListener (wrong name: org/scalatra/RailsRouteMatcher$Builder)
        at java.lang.ClassLoader.defineClass1(Native Method)[:1.6.0_25]
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)[:1.6.0_25]
        at java.lang.ClassLoader.defineClass(ClassLoader.java:615)[:1.6.0_25]
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2128)
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)
        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)[:1.6.0_25]
        at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1317)
        at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1481)
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1427)
        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)[:1.6.0_25]
        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1723)
        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:926)
        at org.ops4j.pax.swissbox.core.BundleClassLoader.findClass(BundleClassLoader.java:176)
        at org.ops4j.pax.swissbox.core.BundleClassLoader.loadClass(BundleClassLoader.java:194)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_25]
        at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorHS.newInstance(RegisterWebAppVisitorHS.java:221)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorWC.visit(RegisterWebAppVisitorWC.java:269)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.web.extender.war.internal.model.WebApp.accept(WebApp.java:593)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.register(WebAppPublisher.java:170)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.serviceChanged(WebAppPublisher.java:155)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.serviceChanged(WebAppPublisher.java:119)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.swissbox.tracker.ReplaceableService.setService(ReplaceableService.java:114)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.swissbox.tracker.ReplaceableService.access$100(ReplaceableService.java:28)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.swissbox.tracker.ReplaceableService$CollectionListener.serviceAdded(ReplaceableService.java:183)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.swissbox.tracker.ServiceCollection$Tracker.addingService(ServiceCollection.java:181)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932)[karaf.jar:2.3.0]
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)[karaf.jar:2.3.0]
        at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[karaf.jar:2.3.0]
        at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)[karaf.jar:2.3.0]
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:317)[karaf.jar:2.3.0]
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)[karaf.jar:2.3.0]
        at org.ops4j.pax.swissbox.tracker.ServiceCollection.onStart(ServiceCollection.java:139)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle$Stopped.start(AbstractLifecycle.java:121)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle.start(AbstractLifecycle.java:49)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.swissbox.tracker.ReplaceableService.onStart(ReplaceableService.java:146)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle$Stopped.start(AbstractLifecycle.java:121)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle.start(AbstractLifecycle.java:49)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher.publish(WebAppPublisher.java:81)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.web.extender.war.internal.WebXmlObserver.deploy(WebXmlObserver.java:200)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.web.extender.war.internal.WebXmlObserver.addingEntries(WebXmlObserver.java:159)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at org.ops4j.pax.swissbox.extender.BundleWatcher$3.run(BundleWatcher.java:224)[90:org.ops4j.pax.web.pax-web-extender-war:1.1.3]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_25]
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_25]
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_25]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)[:1.6.0_25]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)[:1.6.0_25]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_25]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_25]
        at java.lang.Thread.run(Thread.java:662)[:1.6.0_25]
Reply | Threaded
Open this post in threaded view
|

Re: [2.3.0] NoClassDefFoundError (wrong name: ...)

barnesjd
I finally figured out the issue!  It wasn't related to Karaf or scalatra at all.  I had created a tool to "osgi-ify" my dependencies, and it wasn't doing it right.  I've detailed it in a blog post for anyone who is interested. http://barnesjd.wordpress.com/2013/01/26/noclassdeffounderror-wrong-name/