java - org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [MyXYZ.class] -
i implementing restful web application jersey+spring+mongo+solr.
after adding solr dependency, application not working on production environment. however, it's works when run in eclipse (by using run >> run on server).
below pom.xml
<dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <!-- jersey --> <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-server</artifactid> <version>1.8</version> </dependency> <dependency> <groupid>com.sun.jersey.contribs</groupid> <artifactid>jersey-multipart</artifactid> <version>1.8</version> </dependency> <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-json</artifactid> <version>1.8</version> </dependency> <!-- spring 3 dependencies --> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>3.2.12.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> <version>3.2.12.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> <version>3.2.12.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context-support</artifactid> <version>3.2.12.release</version> </dependency> <!-- jersey + spring --> <dependency> <groupid>com.sun.jersey.contribs</groupid> <artifactid>jersey-spring</artifactid> <version>1.8</version> <exclusions> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring</artifactid> </exclusion> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> </exclusion> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> </exclusion> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-beans</artifactid> </exclusion> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> </exclusion> </exclusions> </dependency> <!-- servlet --> <dependency> <groupid>javax.servlet</groupid> <artifactid>servlet-api</artifactid> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupid>javax.servlet.jsp</groupid> <artifactid>jsp-api</artifactid> <version>2.1</version> <scope>provided</scope> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>jstl</artifactid> <version>1.2</version> </dependency> <!-- mongodb java driver --> <dependency> <groupid>org.mongodb</groupid> <artifactid>mongo-java-driver</artifactid> <version>2.12.1</version> </dependency> <!-- spring data mongodb --> <dependency> <groupid>org.springframework.data</groupid> <artifactid>spring-data-mongodb</artifactid> <version>1.5.0.release</version> </dependency> <dependency> <groupid>cglib</groupid> <artifactid>cglib</artifactid> <version>2.2.2</version> </dependency> <!-- apache http client --> <dependency> <groupid>org.apache.httpcomponents</groupid> <artifactid>httpclient</artifactid> <version>4.2.1</version> </dependency> <!-- apache-commons_collections --> <dependency> <groupid>commons-collections</groupid> <artifactid>commons-collections</artifactid> <version>3.2.1</version> </dependency> <!-- apache io utility --> <dependency> <groupid>commons-io</groupid> <artifactid>commons-io</artifactid> <version>2.4</version> </dependency> <!-- apache commons fileupload --> <dependency> <groupid>commons-fileupload</groupid> <artifactid>commons-fileupload</artifactid> <version>1.3.1</version> </dependency> <!-- base64 encoding decoding --> <dependency> <groupid>commons-codec</groupid> <artifactid>commons-codec</artifactid> <version>1.9</version> </dependency> <!-- dozer --> <dependency> <groupid>net.sf.dozer</groupid> <artifactid>dozer</artifactid> <version>5.4.0</version> </dependency> <!-- java mail --> <dependency> <groupid>javax.mail</groupid> <artifactid>mail</artifactid> <version>1.4.7</version> </dependency> <!-- joda_time --> <dependency> <groupid>joda-time</groupid> <artifactid>joda-time</artifactid> <version>2.3</version> </dependency> <!-- spring data solr --> <dependency> <groupid>org.springframework.data</groupid> <artifactid>spring-data-solr</artifactid> <version>1.2.6.release</version> </dependency> </dependencies>
and here full stack trace
severe: exception sending context initialized event listener instance of class org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.beandefinitionstoreexception: failed read candidate component class: file [/home/isank/hacks/servers/apache-tomcat-prod/webapps/dpdoctor/web-inf/classes/com/dpdocter/collections/patientclinicalnotescollection.class]; nested exception java.lang.incompatibleclasschangeerror: class org.springframework.core.type.classreading.classmetadatareadingvisitor has interface org.springframework.asm.classvisitor super class @ org.springframework.context.annotation.classpathscanningcandidatecomponentprovider.findcandidatecomponents(classpathscanningcandidatecomponentprovider.java:290) @ org.springframework.context.annotation.classpathbeandefinitionscanner.doscan(classpathbeandefinitionscanner.java:242) @ org.springframework.context.annotation.componentscanbeandefinitionparser.parse(componentscanbeandefinitionparser.java:84) @ org.springframework.beans.factory.xml.namespacehandlersupport.parse(namespacehandlersupport.java:73) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1432) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1422) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.parsebeandefinitions(defaultbeandefinitiondocumentreader.java:187) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.doregisterbeandefinitions(defaultbeandefinitiondocumentreader.java:147) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.registerbeandefinitions(defaultbeandefinitiondocumentreader.java:101) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.registerbeandefinitions(xmlbeandefinitionreader.java:495) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:391) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:335) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:303) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:174) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:209) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:180) @ org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:125) @ org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:94) @ org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:130) @ org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:539) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:451) @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:410) @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:306) @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:112) @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4992) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5490) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:901) @ org.apache.catalina.core.containerbase.addchild(containerbase.java:877) @ org.apache.catalina.core.standardhost.addchild(standardhost.java:649) @ org.apache.catalina.startup.hostconfig.deploydirectory(hostconfig.java:1247) @ org.apache.catalina.startup.hostconfig$deploydirectory.run(hostconfig.java:1898) @ java.util.concurrent.executors$runnableadapter.call(executors.java:471) @ java.util.concurrent.futuretask.run(futuretask.java:262) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:745) caused by: java.lang.incompatibleclasschangeerror: class org.springframework.core.type.classreading.classmetadatareadingvisitor has interface org.springframework.asm.classvisitor super class @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:800) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ org.apache.catalina.loader.webappclassloader.findclassinternal(webappclassloader.java:2957) @ org.apache.catalina.loader.webappclassloader.findclass(webappclassloader.java:1210) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1690) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1571) @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:800) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ org.apache.catalina.loader.webappclassloader.findclassinternal(webappclassloader.java:2957) @ org.apache.catalina.loader.webappclassloader.findclass(webappclassloader.java:1210) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1690) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1571) @ org.springframework.core.type.classreading.simplemetadatareader.<init>(simplemetadatareader.java:63) @ org.springframework.core.type.classreading.simplemetadatareaderfactory.getmetadatareader(simplemetadatareaderfactory.java:96) @ org.springframework.core.type.classreading.cachingmetadatareaderfactory.getmetadatareader(cachingmetadatareaderfactory.java:102) @ org.springframework.context.annotation.classpathscanningcandidatecomponentprovider.findcandidatecomponents(classpathscanningcandidatecomponentprovider.java:266) ... 36 more jul 24, 2015 1:41:35 org.apache.catalina.core.standardcontext startinternal severe: error listenerstart jul 24, 2015 1:41:35 org.apache.catalina.core.standardcontext startinternal severe: context [/dpdoctor] startup failed due previous errors jul 24, 2015 1:41:35 org.apache.catalina.core.applicationcontext log info: closing spring root webapplicationcontext jul 24, 2015 1:41:35 org.apache.catalina.core.standardcontext listenerstop severe: exception sending context destroyed event listener instance of class org.springframework.web.context.contextloaderlistener java.lang.illegalstateexception: beanfactory not initialized or closed - call 'refresh' before accessing beans via applicationcontext @ org.springframework.context.support.abstractrefreshableapplicationcontext.getbeanfactory(abstractrefreshableapplicationcontext.java:171) @ org.springframework.context.support.abstractapplicationcontext.destroybeans(abstractapplicationcontext.java:1092) @ org.springframework.context.support.abstractapplicationcontext.doclose(abstractapplicationcontext.java:1066) @ org.springframework.context.support.abstractapplicationcontext.close(abstractapplicationcontext.java:1012) @ org.springframework.web.context.contextloader.closewebapplicationcontext(contextloader.java:586) @ org.springframework.web.context.contextloaderlistener.contextdestroyed(contextloaderlistener.java:143) @ org.apache.catalina.core.standardcontext.listenerstop(standardcontext.java:5033) @ org.apache.catalina.core.standardcontext.stopinternal(standardcontext.java:5685) @ org.apache.catalina.util.lifecyclebase.stop(lifecyclebase.java:232) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:160) @ org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:901) @ org.apache.catalina.core.containerbase.addchild(containerbase.java:877) @ org.apache.catalina.core.standardhost.addchild(standardhost.java:649) @ org.apache.catalina.startup.hostconfig.deploydirectory(hostconfig.java:1247) @ org.apache.catalina.startup.hostconfig$deploydirectory.run(hostconfig.java:1898) @ java.util.concurrent.executors$runnableadapter.call(executors.java:471) @ java.util.concurrent.futuretask.run(futuretask.java:262) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:745)
i know there questions similar 1 accepted solutions, that's not working me. eg. have tried changing versions in pom , etc.
here's maven dependency resolution tree (mvn dependency:tree)
[info] +- junit:junit:jar:3.8.1:test [info] +- com.sun.jersey:jersey-server:jar:1.8:compile [info] | +- asm:asm:jar:3.1:compile [info] | \- com.sun.jersey:jersey-core:jar:1.8:compile [info] +- com.sun.jersey.contribs:jersey-multipart:jar:1.8:compile [info] | \- org.jvnet:mimepull:jar:1.4:compile [info] +- com.sun.jersey:jersey-json:jar:1.8:compile [info] | +- org.codehaus.jettison:jettison:jar:1.1:compile [info] | | \- stax:stax-api:jar:1.0.1:compile [info] | +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile [info] | | \- javax.xml.bind:jaxb-api:jar:2.2.2:compile [info] | | \- javax.xml.stream:stax-api:jar:1.0-2:compile [info] | +- org.codehaus.jackson:jackson-core-asl:jar:1.7.1:compile [info] | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.7.1:compile [info] | +- org.codehaus.jackson:jackson-jaxrs:jar:1.7.1:compile [info] | \- org.codehaus.jackson:jackson-xc:jar:1.7.1:compile [info] +- org.springframework:spring-core:pom:3.2.12.release:import [info] | \- commons-logging:commons-logging:jar:1.1.3:compile [info] +- org.springframework:spring-context:jar:3.2.12.release:compile [info] | +- org.springframework:spring-beans:jar:3.2.12.release:compile [info] | +- org.springframework:spring-core:jar:3.2.12.release:compile [info] | \- org.springframework:spring-expression:jar:3.2.12.release:compile [info] +- org.springframework:spring-web:jar:3.2.12.release:compile [info] +- org.springframework:spring-context-support:jar:3.2.12.release:compile [info] +- com.sun.jersey.contribs:jersey-spring:jar:1.8:compile [info] | \- org.springframework:spring-aop:jar:3.0.0.rc3:compile (version selected constraint [2.5.2,3)) [info] | +- aopalliance:aopalliance:jar:1.0:compile [info] | \- org.springframework:spring-asm:jar:3.0.0.rc3:compile [info] +- javax.servlet:servlet-api:jar:2.5:provided [info] +- javax.servlet.jsp:jsp-api:jar:2.1:provided [info] +- javax.servlet:jstl:jar:1.2:compile [info] +- org.mongodb:mongo-java-driver:jar:2.12.1:compile [info] +- org.springframework.data:spring-data-mongodb:jar:1.5.0.release:compile [info] | +- org.springframework:spring-tx:jar:3.2.9.release:compile [info] | +- org.springframework.data:spring-data-commons:jar:1.8.0.release:compile [info] | +- org.slf4j:slf4j-api:jar:1.7.7:compile [info] | \- org.slf4j:jcl-over-slf4j:jar:1.7.7:compile [info] +- cglib:cglib:jar:2.2.2:compile [info] +- org.apache.httpcomponents:httpclient:jar:4.2.1:compile [info] | \- org.apache.httpcomponents:httpcore:jar:4.2.1:compile [info] +- commons-collections:commons-collections:jar:3.2.1:compile [info] +- commons-io:commons-io:jar:2.4:compile [info] +- commons-fileupload:commons-fileupload:jar:1.3.1:compile [info] +- commons-codec:commons-codec:jar:1.9:compile [info] +- net.sf.dozer:dozer:jar:5.4.0:compile [info] | +- commons-beanutils:commons-beanutils:jar:1.8.3:compile [info] | +- org.apache.commons:commons-lang3:jar:3.1:compile [info] | \- org.slf4j:slf4j-log4j12:jar:1.6.6:compile [info] | \- log4j:log4j:jar:1.2.17:compile [info] +- javax.mail:mail:jar:1.4.7:compile [info] | \- javax.activation:activation:jar:1.1:compile [info] +- joda-time:joda-time:jar:2.3:compile [info] \- org.springframework.data:spring-data-solr:jar:1.4.1.release:compile [info] +- org.apache.httpcomponents:httpmime:jar:4.2.2:compile [info] +- org.apache.httpcomponents:httpclient-cache:jar:4.2.2:compile [info] +- org.apache.solr:solr-solrj:jar:4.10.1:compile [info] | +- org.apache.zookeeper:zookeeper:jar:3.4.6:compile [info] | +- org.codehaus.woodstox:wstx-asl:jar:3.2.7:compile [info] | \- org.noggit:noggit:jar:0.5:compile [info] \- com.fasterxml.jackson.core:jackson-databind:jar:2.5.1:compile [info] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.5.0:compile [info] \- com.fasterxml.jackson.core:jackson-core:jar:2.5.1:compile
i'm sorry if missed tree, not expert in one.
would please try following in pom.xml?
<exclusions> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-asm</artifactid> </exclusion> </exclusions>
Comments
Post a Comment