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

Advertisements

26 Responses to “ClassNotFoundException: org.objectweb.asm.ClassVisitor”

  1. Even I get the same error; not sure why – asm.jar is there in classpath. hope u go the solution for it and it will be great if you can share

  2. I just recently downloaded Jetty-8.0.3, installed the Jetty WTP Eclipse plugin, and configured a new Server in Eclipse. Jetty starts up fine, but when I unzipped the test.war (included in the distribution, found under jetty/webapps) into a directory and added that as a new external web module in Eclipse, I got the same error message. I googled it and wound up here. 😉

    Anyway, in my case the problem was that Eclipse hadn’t added all the necessary .jars into the Jetty classpath; in this case namely the org.objectweb.asm.jar found under jetty/lib/annotations.

    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

    • @Juuso Backman:
      Thanks for the reply, as soon as I have some spare time I will get back to Jetty again. For now, Tomcat is working fine!

  3. Thanks Juuso Backman for your suggestion. It works for me.

  4. Thanks for the direct solution

  5. I faced the same error
    java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
    ….
    I fixed it by downloading and adding asm-3.3.1 version for jersey, it fixed the error

  6. thanks alok…it works…

  7. @Juuso Backman, Alok – I faced the same issue. It worked after adding asm-3.1.jar in classpath

  8. Thanks for the fix – much appreciated

  9. Hi All. I had the same problem, even if all the JARs were imported. BUT IT WORKED when I did : Right click on my Jetty server / Properties / General / Switch de Location “default” to “/Servers/Jetty…….”. Hope it helped

  10. This solution really worked – I fixed it by downloading and adding asm-3.3.1 version for jersey, it fixed the error.
    Thanks,
    -Suman

  11. @Juuso Backman thanks for the solution

Trackbacks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: