java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor JIRA | gazmoo | 3 years ago
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    When embedding Jersey in a standalone Java app, I've specified a set of singleton resources in my ResourceConfig using {noformat} resourceConfig.registerInstances(resources); {noformat} I then publish the resources in Jetty using {noformat} webabbContext.add(new ServletHolder(new ServletContainer(resourceConfig)), pathToJersey); {noformat} I excluded the repackaged ASM jars in my Maven POM because of a conflict with other libraries in the application: {noformat} <exclusion> <groupId>org.glassfish.hk2.external</groupId> <artifactId>asm-all-repackaged</artifactId> </exclusion> {noformat} However, when the servlets are initialised, the following exception is thrown: {noformat} java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor at org.glassfish.jersey.server.ResourceConfig.scanClasses( at org.glassfish.jersey.server.ResourceConfig._getClasses( at org.glassfish.jersey.server.ResourceConfig.getClasses( at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.<init>( at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.<init>( at org.glassfish.jersey.server.ResourceConfig.createRuntimeConfig( at org.glassfish.jersey.server.ApplicationHandler.<init>( at org.glassfish.jersey.servlet.WebComponent.<init>( at org.glassfish.jersey.servlet.ServletContainer.init( at org.glassfish.jersey.servlet.ServletContainer.init( at javax.servlet.GenericServlet.init( at com.gaz.test.JerseySpringSingletonBeansServlet.init( at org.eclipse.jetty.servlet.ServletHolder.initServlet( at org.eclipse.jetty.servlet.ServletHolder.initialize( at org.eclipse.jetty.servlet.ServletHandler.initialize( at org.eclipse.jetty.servlet.ServletContextHandler.startContext( at org.eclipse.jetty.webapp.WebAppContext.startContext( at org.eclipse.jetty.server.handler.ContextHandler.doStart( at org.eclipse.jetty.webapp.WebAppContext.doStart( at org.eclipse.jetty.util.component.AbstractLifeCycle.start( at org.eclipse.jetty.util.component.ContainerLifeCycle.start( at org.eclipse.jetty.server.Server.start( at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart( at org.eclipse.jetty.server.handler.AbstractHandler.doStart( at org.eclipse.jetty.server.Server.doStart( at org.eclipse.jetty.util.component.AbstractLifeCycle.start( at Main.start( at Main.main( {noformat} There appears to be no easy way to prevent the exception. Debugging the application, I noted that the {{ResourceConfig._getClasses()}} method does not return any classes in my case - it does not attempt to do any scanning, but the ClassVisitor is still instantiated in the AnnotationAcceptingListener constructor, throwing the exception. I've worked around it temporarily by extending the ResourceConfig class and overriding the _getClasses() method to just return an empty set. I had to extend it in the same package, because the method is package private. I could not use the Application class instead of the ResourceConfig class because the ServletContainer only accepts a ResourceConfig. It could be fixed a number of ways: * Allow users to completely disable classpath scanning, and don't attempt to create ASM objects if it's disabled * Make the ResourceConfig more easily extensible for customisation * Hide all implementation details of classpath scanning (move the bundled ASM into a different package to avoid conflicts) JIRA | 3 years ago | gazmoo
    java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
  2. 0

    xmpp server component error

    Stack Overflow | 3 years ago | user3599456
    java.lang.NoClassDefFoundError: org/xmpp/component/Log
  3. 0

    Working with Xstream, clarification needed

    Stack Overflow | 5 years ago | Jam
    java.lang.NoClassDefFoundError: org/codehaus/jettison/mapped/Configuration at;init&gt;(
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Specifying classpath in Sun CDC Toolkit

    Oracle Community | 9 years ago | 843849
    java.lang.NoClassDefFoundError: deleteme.DeleteMe
  6. 0

    java (and javac) are defined to treat empty path elements in -classpath as ".". It looks like there is a regression in JDK 9 such that a trailing empty path element is lost (and thus not treated as "."). This was detected by resuscitating the javac test langtools/test/tools/javac/Paths/ which has been disabled for a while during Jigsaw development. (Sigh). Here is a very stripped down version that demonstrates the bug: ---------------------------------- #!/bin/sh JDK=/opt/jdk/1.9.0 mkdir -p MyDir echo 'public class Lib {public static void f(){}}' > $JDK/bin/javac -d MyDir echo 'public class Main {public static void main(String[] a) {Lib.f();}}' > $JDK/bin/javac -cp MyDir cd MyDir $JDK/bin/java -cp ..: Main ---------------------------------- Here is the result of running the script: $ sh -x + JDK=/opt/jdk/1.9.0 + mkdir -p MyDir + echo public class Lib {public static void f(){}} + /opt/jdk/1.9.0/bin/javac -d MyDir + echo public class Main {public static void main(String[] a) {Lib.f();}} + /opt/jdk/1.9.0/bin/javac -cp MyDir + cd MyDir + /opt/jdk/1.9.0/bin/java -cp ..: Main Exception in thread "main" java.lang.NoClassDefFoundError: Lib at Main.main( Caused by: java.lang.ClassNotFoundException: Lib at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9-ea/ at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9-ea/ at java.lang.ClassLoader.loadClass(java.base@9-ea/ ... 1 more If you edit the script to run JDK 8, you get the following output (i.e. no error, as expected) $ sh -x + JDK=/opt/jdk/1.8.0 + mkdir -p MyDir + echo public class Lib {public static void f(){}} + /opt/jdk/1.8.0/bin/javac -d MyDir + echo public class Main {public static void main(String[] a) {Lib.f();}} + /opt/jdk/1.8.0/bin/javac -cp MyDir + cd MyDir + /opt/jdk/1.8.0/bin/java -cp ..: Main

    JDK Bug System | 1 year ago | Jonathan Gibbons
    java.lang.NoClassDefFoundError: Lib

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NoClassDefFoundError


      at org.glassfish.jersey.server.ResourceConfig.scanClasses()
    2. jersey-core-server
      1. org.glassfish.jersey.server.ResourceConfig.scanClasses(
      2. org.glassfish.jersey.server.ResourceConfig._getClasses(
      3. org.glassfish.jersey.server.ResourceConfig.getClasses(
      4. org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.<init>(
      5. org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.<init>(
      6. org.glassfish.jersey.server.ResourceConfig.createRuntimeConfig(
      7. org.glassfish.jersey.server.ApplicationHandler.<init>(
      7 frames
    3. jersey-container-servlet-core
      1. org.glassfish.jersey.servlet.WebComponent.<init>(
      2. org.glassfish.jersey.servlet.ServletContainer.init(
      3. org.glassfish.jersey.servlet.ServletContainer.init(
      3 frames
    4. JavaServlet
      1. javax.servlet.GenericServlet.init(
      1 frame
    5. com.gaz.test
      1. com.gaz.test.JerseySpringSingletonBeansServlet.init(
      1 frame
    6. Jetty
      1. org.eclipse.jetty.servlet.ServletHolder.initServlet(
      2. org.eclipse.jetty.servlet.ServletHolder.initialize(
      3. org.eclipse.jetty.servlet.ServletHandler.initialize(
      4. org.eclipse.jetty.servlet.ServletContextHandler.startContext(
      5. org.eclipse.jetty.webapp.WebAppContext.startContext(
      6. org.eclipse.jetty.server.handler.ContextHandler.doStart(
      7. org.eclipse.jetty.webapp.WebAppContext.doStart(
      8. org.eclipse.jetty.util.component.AbstractLifeCycle.start(
      9. org.eclipse.jetty.util.component.ContainerLifeCycle.start(
      10. org.eclipse.jetty.server.Server.start(
      11. org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(
      12. org.eclipse.jetty.server.handler.AbstractHandler.doStart(
      13. org.eclipse.jetty.server.Server.doStart(
      14. org.eclipse.jetty.util.component.AbstractLifeCycle.start(
      14 frames
    7. Unknown
      1. Main.start(
      2. Main.main(
      2 frames