Could not initialize class MongoRepositoryConfigurationExtension - MongoDB with Spring 4.2 -
i trying build app spring 4.2, spring-data-mongodb-1.8.0 , spring-data-commons-1.11.0. following exception thrown @ runtime.
kindly help. have been stuck 2 days.
thanks help.
console log
oct 10, 2015 11:56:16 org.apache.catalina.core.applicationcontext log severe: standardwrapper.throwable org.springframework.beans.factory.beandefinitionstoreexception: unexpected exception parsing xml document servletcontext resource [/web-inf/spring-dispatcher-servlet.xml]; nested exception org.springframework.beans.fatalbeanexception: invalid namespacehandler class [org.springframework.data.mongodb.repository.config.mongorepositoryconfignamespacehandler] namespace [http://www.springframework.org/schema/data/mongo]: problem handler class file or dependent class; nested exception java.lang.noclassdeffounderror: not initialize class org.springframework.data.mongodb.repository.config.mongorepositoryconfigurationextension @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:414) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:336) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:304) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:181) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:217) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:188) @ 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:129) @ org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:604) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:509) @ org.springframework.web.servlet.frameworkservlet.configureandrefreshwebapplicationcontext(frameworkservlet.java:667) @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:633) @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:681) @ org.springframework.web.servlet.frameworkservlet.initwebapplicationcontext(frameworkservlet.java:552) @ org.springframework.web.servlet.frameworkservlet.initservletbean(frameworkservlet.java:493) @ org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:136) @ javax.servlet.genericservlet.init(genericservlet.java:158) @ org.apache.catalina.core.standardwrapper.initservlet(standardwrapper.java:1284) @ org.apache.catalina.core.standardwrapper.loadservlet(standardwrapper.java:1197) @ org.apache.catalina.core.standardwrapper.allocate(standardwrapper.java:864) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:134) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:505) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:170) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:956) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:423) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1079) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:625) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:316) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(unknown source) caused by: org.springframework.beans.fatalbeanexception: invalid namespacehandler class [org.springframework.data.mongodb.repository.config.mongorepositoryconfignamespacehandler] namespace [http://www.springframework.org/schema/data/mongo]: problem handler class file or dependent class; nested exception java.lang.noclassdeffounderror: not initialize class org.springframework.data.mongodb.repository.config.mongorepositoryconfigurationextension @ org.springframework.beans.factory.xml.defaultnamespacehandlerresolver.resolve(defaultnamespacehandlerresolver.java:140) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1406) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1401) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.parsebeandefinitions(defaultbeandefinitiondocumentreader.java:168) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.doregisterbeandefinitions(defaultbeandefinitiondocumentreader.java:138) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.registerbeandefinitions(defaultbeandefinitiondocumentreader.java:94) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.registerbeandefinitions(xmlbeandefinitionreader.java:508) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:392) ... 35 more caused by: java.lang.noclassdeffounderror: not initialize class org.springframework.data.mongodb.repository.config.mongorepositoryconfigurationextension @ org.springframework.data.mongodb.repository.config.mongorepositoryconfignamespacehandler.init(mongorepositoryconfignamespacehandler.java:37) @ org.springframework.beans.factory.xml.defaultnamespacehandlerresolver.resolve(defaultnamespacehandlerresolver.java:131) ... 42 more oct 10, 2015 11:56:16 org.apache.catalina.core.standardwrappervalve invoke severe: allocate exception servlet spring-dispatcher java.lang.noclassdeffounderror: not initialize class org.springframework.data.mongodb.repository.config.mongorepositoryconfigurationextension @ org.springframework.data.mongodb.repository.config.mongorepositoryconfignamespacehandler.init(mongorepositoryconfignamespacehandler.java:37) @ org.springframework.beans.factory.xml.defaultnamespacehandlerresolver.resolve(defaultnamespacehandlerresolver.java:131) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1406) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1401) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.parsebeandefinitions(defaultbeandefinitiondocumentreader.java:168) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.doregisterbeandefinitions(defaultbeandefinitiondocumentreader.java:138) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.registerbeandefinitions(defaultbeandefinitiondocumentreader.java:94) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.registerbeandefinitions(xmlbeandefinitionreader.java:508) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:392) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:336) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:304) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:181) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:217) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:188) @ 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:129) @ org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:604) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:509) @ org.springframework.web.servlet.frameworkservlet.configureandrefreshwebapplicationcontext(frameworkservlet.java:667) @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:633) @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:681) @ org.springframework.web.servlet.frameworkservlet.initwebapplicationcontext(frameworkservlet.java:552) @ org.springframework.web.servlet.frameworkservlet.initservletbean(frameworkservlet.java:493) @ org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:136) @ javax.servlet.genericservlet.init(genericservlet.java:158) @ org.apache.catalina.core.standardwrapper.initservlet(standardwrapper.java:1284) @ org.apache.catalina.core.standardwrapper.loadservlet(standardwrapper.java:1197) @ org.apache.catalina.core.standardwrapper.allocate(standardwrapper.java:864) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:134) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:505) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:170) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:956) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:423) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1079) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:625) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:316) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(unknown source)
spring-dispatcher-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.8.xsd"> <context:component-scan base-package="com.whiplash.reviewr.controller" /> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix"> <value>/web-inf/jsp/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> <mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:annotation-driven /> <bean id="writerservice" class="com.whiplash.reviewr.service.writerserviceimpl"> <property name="dao" ref="writerdao"/> </bean> <bean id="writerdao" class="com.whiplash.reviewr.dao.writerdaoimpl"> <property name="mongotemplate" ref="mongotemplate"/> </bean> <!-- default bean name 'mongo' --> <mongo:mongo host="localhost" port="33107"> <!-- optional: configure <mongo:options /> --> </mongo:mongo> <mongo:db-factory dbname="whiplashdb" mongo-ref="mongo"/> <bean id="mongotemplate" class="org.springframework.data.mongodb.core.mongotemplate"> <constructor-arg ref="mongodbfactory"/> </bean> </beans>
jars in lib folder
commons-logging-1.2.1.1.jar javax.persistence.jar jstl-1.2.jar mongo-java-driver-3.1.0.jar spring-aop-4.2.1.release.jar spring-aspects-4.2.1.release.jar spring-beans-4.2.1.release.jar spring-context-4.2.1.release.jar spring-context-support-4.2.1.release.jar spring-core-4.2.1.release.jar spring-data-commons-1.11.0.release.jar spring-data-mongodb-1.8.0.release.jar spring-expression-4.2.1.release.jar spring-instrument-4.2.1.release.jar spring-instrument-tomcat-4.2.1.release.jar spring-jdbc-4.2.1.release.jar spring-jms-4.2.1.release.jar spring-messaging-4.2.1.release.jar spring-orm-4.2.1.release.jar spring-oxm-4.2.1.release.jar spring-tx-4.2.1.release.jar spring-web-4.2.1.release.jar spring-webmvc-4.2.1.release.jar spring-websocket-4.2.1.release.jar
even-though not asked encourage leverage build mgt tools maven
or gradle
etc, of seamlessly resolve of transitive dependencies issue here , increase productivity rate tremendously a quick you-tube started maven
plain spring mvc app pom.xml focus on mongo dependencies part
spring boot app pom.xml focus on mongo party
in both cases i've used bom deal dependencies versions mismatch explained here
Comments
Post a Comment