java.lang.ExceptionInInitializerError

Stack Overflow | David Sykes | 7 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    NoClassDefFoundError using mahout

    Stack Overflow | 4 years ago | emab
    java.lang.ExceptionInInitializerError
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    h4. Status Quo The {{spring-test-mvc}} builds fine from the command line with Gradle; however, when Eclipse projects are created with the {{import-into-eclipse.sh}} script and the tests in {{spring-test-mvc}} are then executed within Eclipse, we run into classpath issues. For example, if you execute {{MockMvcClientHttpRequestFactoryTests}} within Eclipse, you will see the following messages in the console: {noformat} SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/Users/sbrannen/.gradle/caches/artifacts-15/filestore/org.slf4j/slf4j-jcl/1.6.1/jar/b5902b1ba8ec58a96140bb7445037b3512cc99bb/slf4j-jcl-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/Users/sbrannen/.gradle/caches/artifacts-15/filestore/org.slf4j/slf4j-log4j12/1.6.1/jar/bd245d6746cdd4e6203e976e21d597a46f115802/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Detected both jcl-over-slf4j.jar AND slf4j-jcl.jar on the class path, preempting StackOverflowError. SLF4J: See also http://www.slf4j.org/codes.html#jclDelegationLoop for more details. {noformat} And the test fails with the following stacktrace: {noformat} java.lang.ExceptionInInitializerError at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:82) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:51) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241) at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155) at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<clinit>(SpringJUnit4ClassRunner.java:91) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:58) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:58) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:27) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.IllegalStateException: Detected both jcl-over-slf4j.jar AND slf4j-jcl.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#jclDelegationLoop for more details. at org.slf4j.impl.JCLLoggerFactory.<clinit>(JCLLoggerFactory.java:64) ... 28 more {noformat} h4. Analysis As a result of work performed in conjunction with SPR-9421, all other modules that require SLF4J for tests now declare a dependency on {{slf4j-jcl}}; however, {{spring-test-mvc}} still declares test dependencies on {{jcl-over-slf4j}} and {{slf4j-log4j12}}. Furthermore, it appears that some dependency of {{spring-test-mvc}} pulls in a transitive dependency on {{jcl-over-slf4j:1.5.8}} which may be the underlying source of the problem. h4. Deliverables # (/) Modify the Gradle build (i.e., the dependency management) so that the generated Eclipse {{.classpath}} for {{spring-test-mvc}} allows tests to run within Eclipse as well as from the command line with Gradle.

    Spring JIRA | 4 years ago | Sam Brannen
    java.lang.ExceptionInInitializerError

    5 unregistered visitors
    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.IllegalStateException

      Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.

      at org.slf4j.impl.Log4jLoggerFactory.<clinit>()
    2. SLF4J LOG4J-12 Binding
      StaticLoggerBinder.<clinit>
      1. org.slf4j.impl.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:54)
      2. org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:72)
      3. org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:45)
      3 frames
    3. SLF4J API Module
      LoggerFactory.getLogger
      1. org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
      2. org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
      3. org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
      4. org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
      5. org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
      5 frames
    4. sso
      HomePageServlet.<clinit>
      1. sso.HomePageServlet.<clinit>(HomePageServlet.java:23)
      1 frame
    5. Java RT
      Class.newInstance
      1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      4. java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      5. java.lang.Class.newInstance(Class.java:442)
      5 frames
    6. Jetty Server
      SelectChannelEndPoint.run
      1. org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
      2. org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428)
      3. org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
      4. org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
      5. org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
      6. org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      7. org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      8. org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
      9. org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)
      10. org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
      11. org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      12. org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      13. org.mortbay.jetty.Server.handle(Server.java:326)
      14. org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      15. org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)
      16. org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
      17. org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      18. org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      19. org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
      19 frames
    7. Jetty Util
      QueuedThreadPool$PoolThread.run
      1. org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      1 frame