Posts tagged ‘Jetty’

January 30, 2011

ClassNotFoundException: org.objectweb.asm.ClassVisitor

by Jay Jonas

Yes! I’m a Jetty Server and Vaadin newbie. But that was a pain try to run Address Book Demo Vaadin tutorial with EclipseLink JPA 2.0 support. I tried with Jetty 7 and Jetty 8 and got all sort of errors using Eclipse WTP. I tested so many configurations and I restarted from ground zero many many times without any success.

Frustrated I installed Apache Tomcat 7 server and automagically all worked as expected on the first strike.

But I really like Jetty and I will give it a new try as soon as I solve this error:

2011-01-30 01:09:50.590:WARN::Unable to reach node goal: started
java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
 at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:71)
 at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:473)
 at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1174)
 at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:598)
 at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:496)
 at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
 at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
 at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:180)
 at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:481)
 at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:137)
 at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:137)
 at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:50)
 at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:470)
 at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:382)
 at org.eclipse.jetty.util.Scanner.scan(Scanner.java:339)
 at org.eclipse.jetty.util.Scanner.start(Scanner.java:275)
 at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:114)
 at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
 at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:542)
 at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:214)
 at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
 at org.eclipse.jetty.server.Server.doStart(Server.java:227)
 at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
 at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1061)
 at java.security.AccessController.doPrivileged(Native Method)
 at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:994)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.eclipse.jetty.start.Main.invokeMain(Main.java:476)
 at org.eclipse.jetty.start.Main.start(Main.java:618)
 at org.eclipse.jetty.start.Main.parseCommandLine(Main.java:272)
 at org.eclipse.jetty.start.Main.main(Main.java:80)

[Updated: 20111013 | from the Juuso Backman’s comment. Thanks, Juuso!]

The problem was that Eclipse hadn’t added all the necessary .jars into the Jetty classpath.

The jars can be added to the classpath for Jetty via Eclipse like so:

  • Open the Servers view
  • Open your server’s config (right-click -> Open, or F3)
  • On the Overview tab, click “Open launch configuration”
  • Classpath tab -> add external jars

// Adding JPA based persistence to the Address Book Demo