java - Failed to load class "org.slf4j.impl.StaticLoggerBinder" after loading required dependencies -


i building maven project , deploying in jetty server , issue. in ${jetty_home}/lib, having jcl-over-slf4j-1.7.2.jar, jul-to-slf4j-1.7.2.jar, slf4j-api-1.7.2.jar. along maven project, having

<dependency>             <groupid>org.slf4j</groupid>             <artifactid>slf4j-log4j12</artifactid>             <version>1.7.2</version>         </dependency>         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>slf4j-api</artifactid>             <version>1.7.2</version>             <scope>provided</scope>         </dependency> 

in mvn dependency tree, slf4j, see following:

[info] +- org.slf4j:slf4j-log4j12:jar:1.7.2:compile [info] |  \- log4j:log4j:jar:1.2.17:compile [info] +- org.slf4j:slf4j-api:jar:1.7.2:provided (scope not updated compile) 

apart this, have commons-logging-1.2.jar bundled project. build maven project , if run using eclipse jetty plugin, having no issues , working fine. after that, try deploy in remote server on jetty webapp folder, , get,

establishing start.log on wed jul 08 12:46:13 pdt 2015 slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. 

i followed steps mentioned in other posts regarding this, still unable fix this. please help. thanks.

you have put slf api in wrong class loader.

class loader hierarchy looks (it may bit inaccurate):

bootstrapclassloader - loads java classes    ^    | extclassloader - loads additional libs    ^    | appclassloader - loads jetty , slf4j-api    ^    | webappclassloader - loads application , can load slf4j-impl 

your classes trigger loading slf4j-api packages , causes delegation webappclassloader appclassloader. slf4j-api classes try load slf4j-impl classes, ask appclassloader them. class loader cannot delegate application class loader (that delegate down in diagram). delegates , finds nothing, hence error.

you have put these libraries in same class loader. either in jetty/lib or war.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -