Friday, 15 January 2010

tomcat - Grails war fails to deploy java.lang.NoClassDefFoundError and SLF4J: Class path contains multiple SLF4J bindings -



tomcat - Grails war fails to deploy java.lang.NoClassDefFoundError and SLF4J: Class path contains multiple SLF4J bindings -

my application works fine when utilize grails run-app when seek run using war file run-war next errors:

i tried solutions proposed here on stack none of them solved problem.

and package/class beingness showed on trace 1 of domain classes :

nested exception java.lang.noclassdeffounderror: gneellaan/ecf

gneellaan = package , ecf = domain class

|running grails application error | slf4j: class path contains multiple slf4j bindings. error | slf4j: found binding in [jar:file:/c:/grails-2.4.2/dist/grails-plugin-log4j-2.4.2.jar!/org/slf4j/impl/staticloggerbinder.class] error | slf4j: found binding in [jar:file:/c:/grails/gneellaan/target/work/tomcat/webapps/gneellaan/web-inf/lib/grails-plugin-log4j-2.4.2.jar!/org/slf4j/impl/staticloggerbinder.class] error | slf4j: see http://www.slf4j.org/codes.html#multiple_bindings explanation. error | slf4j: actual binding of type [org.slf4j.impl.grailsslf4jloggerfactory] 2014-10-23 14:28:08,255 [localhost-startstop-1] error context.contextloader - context initialization failed org.springframework.beans.factory.beancreationexception: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: java.lang.noclassdeffounderror: gneellaan/ecf @ java.lang.class.forname(class.java:340) ... 4 more caused by: java.lang.classnotfoundexception: gneellaan.ecf ... 5 more 2014-10-23 14:28:08,257 [localhost-startstop-1] error context.grailscontextloaderlistener - error initializing application: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf org.springframework.beans.factory.beancreationexception: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: java.lang.noclassdeffounderror: gneellaan/ecf @ java.lang.class.forname(class.java:340) ... 4 more caused by: java.lang.classnotfoundexception: gneellaan.ecf ... 5 more 2014-10-23 14:28:08,258 [localhost-startstop-1] error context.grailscontextloaderlistener - error initializing grails: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf org.springframework.beans.factory.beancreationexception: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: java.lang.noclassdeffounderror: gneellaan/ecf @ java.lang.class.forname(class.java:340) ... 4 more caused by: java.lang.classnotfoundexception: gneellaan.ecf ... 5 more exception sending context initialized event listener instance of class org.codehaus.groovy.grails.web.context.grailscontextloaderlistener org.springframework.beans.factory.beancreationexception: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: java.lang.noclassdeffounderror: gneellaan/ecf @ java.lang.class.forname(class.java:340) ... 4 more caused by: java.lang.classnotfoundexception: gneellaan.ecf ... 5 more error listenerstart context [/gneellaan] startup failed due previous errors web application [/gneellaan] registered jdbc driver [org.h2.driver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered. web application [/gneellaan] registered jdbc driver [com.mysql.jdbc.driver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered. web application [/gneellaan] appears have started thread named [abandoned connection cleanup thread] has failed stop it. create memory leak. |server running. browse http://localhost:9091/gneellaan |server running. browse http://localhost:9091/gneellaan

right - its' classpath problem, , slf4j messages ignorable warnings. there's big difference between java.lang.classnotfoundexception , java.lang.noclassdeffounderror. classnotfoundexception easy - there's no jar file or directory in classpath containing class or resource. prepare classpath, or add together missing library it, , move on.

but noclassdeffounderror (which cause classnotfoundexception) lot harder fix. indicates named class found when loading it, dependency has wasn't met. should relatively rare when using grails, maven, gradle, etc. integrate dependency management, , determine dependencies of dependencies , include those. when configure lookup not recurse through dependency graph, or exclude 1 or more jars think safe exclude, can happen.

i'm guessing gneellaan.ecf class - there's 1 result in google, , it's question (it's technically 2 words, i'm still calling googlewhack). if 3rd-party library, utilize site http://mvnrepository.com/ determine dependencies (e.g. http://mvnrepository.com/artifact/io.hawt/hawtio-util/1.4.27). have source, shouldn't hard find cause. if there's lot going on in class, seek commenting out can , create sure everyting still compiles, remove can.

tomcat grails groovy war slf4j

No comments:

Post a Comment