Class not found org.slf4j.LoggerFactory

2010-04-09
2013-04-25
  • Andrew Mason
    Andrew Mason
    2010-04-09

    I hope someone can help with this.
    I'm trying to run my GWT application via the Google GWT plugin for eclipse.
    I've added log4j-over-slf-1.5.8.jar, slf4j-api-1.5.8.jar, slf4j-log4j12-1.5.8.jar, log4j-1.2.12.jar
    I just can't get rid of the exception below.
    The class is on the classpath, why can't it find it?

    java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
        at net.sf.gilead.core.PersistentBeanManager.<init>(PersistentBeanManager.java:70)
        at net.sf.gilead.core.PersistentBeanManager.getInstance(PersistentBeanManager.java:102)
        at net.sf.gilead.gwt.PersistentRemoteService.<init>(PersistentRemoteService.java:85)
        at uk.co.environit.server.ClimadaptServiceImpl.<init>(ClimadaptServiceImpl.java:72)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
        at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:324)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
        at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
        at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    

    Thanks for any advice.

    Andrew

     
  • Hello,

    Alas, the NoClassDefFound error is symptomatic of a missing jar (slf4j-api in your case), so if you checked your classpath, I do not  have any more clue…

    Regards
    Bruno

     
  • SrArcos
    SrArcos
    2010-11-13

    Hello!

    I have the same problem. I had created a new simple proyect with two tables and a grid. I was following the instructions of the oficial web with User and Message. It is a GWT - Hibernate - Spring proyect with Gilead but I have this error in Console:

    DEBUG [main] JspRuntimeContext.<init>(104) | El cargador de clases es: ContextLoader@null
    DEBUG [main] JspServlet.init(80) | El directorio de trabajo para el motor JSP es: C:\Users\SrArcos\AppData\Local\Temp\Jetty_127_0_0_1_8888_war____-g0qk00\jsp
    DEBUG [main] JspServlet.init(82) | IMPORTANTE: No modifique los servlets generados
    [WARN] Server class 'net.sf.gilead.gwt.PersistentRemoteService' could not be found in the web app, but was found on the system classpath
       [WARN] Adding classpath entry 'file:/C:/home/eclipse/workspace/TestingGilead/recursos/lib/gilead4gwt-1.3.2.1839.jar' to the web app classpath for this session
       For additional info see: file:/C:/home/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.3_2.0.3.v201002191036/gwt-2.0.3/doc/helpInfo/webAppClassPath.html
    [WARN] Server class 'org.springframework.context.ApplicationContext' could not be found in the web app, but was found on the system classpath
       [WARN] Adding classpath entry 'file:/C:/home/eclipse/workspace/TestingGilead/recursos/lib/spring.jar' to the web app classpath for this session
       For additional info see: file:/C:/home/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.3_2.0.3.v201002191036/gwt-2.0.3/doc/helpInfo/webAppClassPath.html
    [WARN] Server class 'net.sf.gilead.core.IPersistenceUtil' could not be found in the web app, but was found on the system classpath
       [WARN] Adding classpath entry 'file:/C:/home/eclipse/workspace/TestingGilead/recursos/lib/gilead-core-1.3.2.1839.jar' to the web app classpath for this session
       For additional info see: file:/C:/home/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.3_2.0.3.v201002191036/gwt-2.0.3/doc/helpInfo/webAppClassPath.html
    [WARN] /testinggilead/greet
    java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
        at net.sf.gilead.core.PersistentBeanManager.<init>(PersistentBeanManager.java:70)
        at net.sf.gilead.core.PersistentBeanManager.getInstance(PersistentBeanManager.java:102)
        at net.sf.gilead.gwt.PersistentRemoteService.<init>(PersistentRemoteService.java:85)
        at org.mdef.ciges.server.GreetingServiceImpl.<init>(GreetingServiceImpl.java:25)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
        at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:324)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
        at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
        at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:354)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
        ... 29 more
    [ERROR] 500 - POST /testinggilead/greet (127.0.0.1) 6997 bytes
       Request headers
          Host: 127.0.0.1:8888
          User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; es-ES; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12
          Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
          Accept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
          Accept-Encoding: gzip,deflate
          Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
          Keep-Alive: 115
          Connection: keep-alive
          Referer: http://127.0.0.1:8888/testinggilead/hosted.html?testinggilead
          Cache-Control: no-cache
          X-GWT-Permutation: HostedMode
          X-GWT-Module-Base: http://127.0.0.1:8888/testinggilead/
          Content-Type: text/x-gwt-rpc; charset=utf-8
          Content-Length: 136
          Pragma: no-cache
       Response headers
          Content-Type: text/html; charset=iso-8859-1
          Content-Length: 6997
    [WARN] 404 - GET /userDataSource (127.0.0.1) 1400 bytes
       Request headers
          Host: 127.0.0.1:8888
          User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; es-ES; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12
          Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
          Accept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
          Accept-Encoding: gzip,deflate
          Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
          Keep-Alive: 115
          Connection: keep-alive
          Referer: http://127.0.0.1:8888/TestingGilead.html?gwt.codesvr=127.0.0.1:9997
          If-Modified-Since: Thu, 1 Jan 1970 00:00:00 GMT
       Response headers
          Content-Type: text/html; charset=iso-8859-1
          Content-Length: 1400
    

    And this is the error in the Development Mode tab:

    21:54:42.140 [ERROR] [testinggilead] 21:54:42.134:XRP4:WARN:DataSource:isc_DataSource_0:one-time fetch failed with status: -90 and messsage: [object Object].  Initializing an empty Array as testData.
    com.smartgwt.client.core.JsObject$SGWT_WARN: 21:54:42.134:XRP4:WARN:DataSource:isc_DataSource_0:one-time fetch failed with status: -90 and messsage: [object Object].  Initializing an empty Array as testData.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
        at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
        at java.lang.Thread.run(Unknown Source)
    

    Some help? (if anyone wants, I can move the project into a zip)

     
  • Hello,

    Same as before : NoClassDefFound means missing jar (probably slf4j-api).
    Please not that the server in complaining about classpath issues (WARN messages in your stack trace).

    Regards
    Bruno

     
  • zwtthappy520
    zwtthappy520
    2011-09-01

    Hello.
    I also encouter the same runtime exception:java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

     
  • Jim Weaver
    Jim Weaver
    2013-02-01

    Anyone figure this out yet?  Lots of folks with same problem - never any answer ;-).