java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/Pattern

QOS.ch JIRA | Al Dispennette | 2 years ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael and Rafael Fischer Viola . Or join the community to write better ones.
  1. 0

    using <logback.version>1.1.2</logback.version> and <logback.audit.version>0.6</logback.audit.version> in a single project I see the following error: java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/Pattern at ch.qos.logback.audit.client.joran.JoranConfigurator.addInstanceRules(JoranConfigurator.java:38) at ch.qos.logback.core.joran.GenericConfigurator.buildInterpreter(GenericConfigurator.java:116) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:146) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49) at ch.qos.logback.audit.client.AuditorFactory.configureByResource(AuditorFactory.java:128) at com.monitise.mvp.common.auditing.MvpAuditProcessorImpl.writeToAuditLog(MvpAuditProcessorImpl.java:95) at com.monitise.mvp.common.auditing.MvpAuditProcessorImpl.auditMessage(MvpAuditProcessorImpl.java:65) at com.monitise.mvp.common.auditing.MvpAbstractAuditor.audit(MvpAbstractAuditor.java:39) at com.monitise.mvp.common.aspect.AuditorAspectTest.auditMethod_aroundBody1$advice(AuditorAspectTest.java:44) at com.monitise.mvp.common.aspect.AuditorAspectTest.auditMethod(AuditorAspectTest.java:1) at com.monitise.mvp.common.aspect.AuditorAspectTest.test(AuditorAspectTest.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.joran.spi.Pattern at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 37 more I believe this is because the Pattern class is part of the 0.9 version of logback-core and the name was changed in later versions. I tried creating a facade for the Pattern class but issues in other transitive dependencies then started showing up.

    QOS.ch JIRA | 2 years ago | Al Dispennette
    java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/Pattern
  2. 0

    using <logback.version>1.1.2</logback.version> and <logback.audit.version>0.6</logback.audit.version> in a single project I see the following error: java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/Pattern at ch.qos.logback.audit.client.joran.JoranConfigurator.addInstanceRules(JoranConfigurator.java:38) at ch.qos.logback.core.joran.GenericConfigurator.buildInterpreter(GenericConfigurator.java:116) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:146) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49) at ch.qos.logback.audit.client.AuditorFactory.configureByResource(AuditorFactory.java:128) at com.monitise.mvp.common.auditing.MvpAuditProcessorImpl.writeToAuditLog(MvpAuditProcessorImpl.java:95) at com.monitise.mvp.common.auditing.MvpAuditProcessorImpl.auditMessage(MvpAuditProcessorImpl.java:65) at com.monitise.mvp.common.auditing.MvpAbstractAuditor.audit(MvpAbstractAuditor.java:39) at com.monitise.mvp.common.aspect.AuditorAspectTest.auditMethod_aroundBody1$advice(AuditorAspectTest.java:44) at com.monitise.mvp.common.aspect.AuditorAspectTest.auditMethod(AuditorAspectTest.java:1) at com.monitise.mvp.common.aspect.AuditorAspectTest.test(AuditorAspectTest.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.joran.spi.Pattern at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 37 more I believe this is because the Pattern class is part of the 0.9 version of logback-core and the name was changed in later versions. I tried creating a facade for the Pattern class but issues in other transitive dependencies then started showing up.

    QOS.ch JIRA | 2 years ago | Al Dispennette
    java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/Pattern
  3. 0
    samebug tip
    You need to add httpcore to your dependencies. Try adding version 4.3 or further.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    samebug tip
    A few things cause this exception: 1) Check if you have all jars and if they're in the correct path when running. 2) Your classpath might be broken, you can define it in the command line with "java -cp yourClassPath" or at your IDE if you're using one.
  6. 0
    samebug tip
    If you're using Hibernate, this indicates you're missing FasterXML Classmate dependency, which you can add to your dependencies. To add it, the groupId is com.fasterxml and artifactId is Classmate.
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.ClassNotFoundException

    ch.qos.logback.core.joran.spi.Pattern

    at java.net.URLClassLoader$1.run()
  2. Java RT
    ClassLoader.loadClass
    1. java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    2. java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    3. java.security.AccessController.doPrivileged(Native Method)
    4. java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    5. java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    6. sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    7. java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    7 frames
  3. Logback Audit Client
    JoranConfigurator.addInstanceRules
    1. ch.qos.logback.audit.client.joran.JoranConfigurator.addInstanceRules(JoranConfigurator.java:38)
    1 frame
  4. Logback Core Module
    GenericConfigurator.doConfigure
    1. ch.qos.logback.core.joran.GenericConfigurator.buildInterpreter(GenericConfigurator.java:116)
    2. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:146)
    3. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
    4. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
    5. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
    5 frames
  5. Logback Audit Client
    AuditorFactory.configureByResource
    1. ch.qos.logback.audit.client.AuditorFactory.configureByResource(AuditorFactory.java:128)
    1 frame
  6. com.monitise.mvp
    AuditorAspectTest.test
    1. com.monitise.mvp.common.auditing.MvpAuditProcessorImpl.writeToAuditLog(MvpAuditProcessorImpl.java:95)
    2. com.monitise.mvp.common.auditing.MvpAuditProcessorImpl.auditMessage(MvpAuditProcessorImpl.java:65)
    3. com.monitise.mvp.common.auditing.MvpAbstractAuditor.audit(MvpAbstractAuditor.java:39)
    4. com.monitise.mvp.common.aspect.AuditorAspectTest.auditMethod_aroundBody1$advice(AuditorAspectTest.java:44)
    5. com.monitise.mvp.common.aspect.AuditorAspectTest.auditMethod(AuditorAspectTest.java:1)
    6. com.monitise.mvp.common.aspect.AuditorAspectTest.test(AuditorAspectTest.java:51)
    6 frames
  7. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:483)
    4 frames
  8. JUnit
    ParentRunner.run
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    5. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    6. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    8. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    9. org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    10. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    11. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    12. org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    13. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    14. org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    14 frames
  9. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    1 frame
  10. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    5 frames