Hibernate-Spring: Java.lang.NoClassDefFoundError: [Lorg/hibernate/engine/FilterDefinition -
my problem is:
spring-cfg.xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource" p:driverclassname="org.h2.driver" p:url="jdbc:h2:~/test" p:username="sa" p:password="sa"/> <bean id="sessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean"> <property name="datasource" ref="datasource" /> <property name="configlocation"> <value>/web-inf/hibernateconf/hibernate.cfg.xml</value> </property> <property name="mappingresources"> <list> <value>/web-inf/hibernateconf/app1user.hbm.xml</value> </list> </property> </bean> <bean id="transactionmanager" class="org.springframework.orm.hibernate4.hibernatetransactionmanager"> <property name="datasource" ref="datasource" /> <property name="sessionfactory" ref="sessionfactory" /> </bean> <bean id="usermanagerdaoimpl" class="app1.persistance.usermanagedaoimpl"> <property name="sessionfactory" ref="sessionfactory"/> </bean> <!-- <tx:annotation-driven/> --> <!-- <bean id="transactionmanager" class="org.springframework.orm.hibernate4.hibernatetransactionmanager"> <property name="sessionfactory" ref="sessionfactory"/> </bean> --> <bean id="usermanagerserviceimpl" class="app1.service.usermanageserviceimpl"> <property name="usermanagedaoif" ref="usermanagerdaoimpl"/> </bean> <import resource="spring-security.xml"/> </beans>
and exception:
severe: context initialization failed org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory' defined in servletcontext resource [/web-inf/springconf/spring-cfg.xml]: initialization of bean failed; nested exception java.lang.noclassdeffounderror: [lorg/hibernate/engine/filterdefinition; @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:547) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:476) @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:303) @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:299) @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:736) @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:757) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:480) @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:403) @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:306) @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:106) @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4728) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5166) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:725) @ org.apache.catalina.core.containerbase.addchild(containerbase.java:701) @ org.apache.catalina.core.standardhost.addchild(standardhost.java:717) @ org.apache.catalina.startup.hostconfig.deploywar(hostconfig.java:940) @ org.apache.catalina.startup.hostconfig.deployapps(hostconfig.java:461) @ org.apache.catalina.startup.hostconfig.check(hostconfig.java:1526) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.apache.tomcat.util.modeler.basemodelmbean.invoke(basemodelmbean.java:300) @ com.sun.jmx.interceptor.defaultmbeanserverinterceptor.invoke(defaultmbeanserverinterceptor.java:819) @ com.sun.jmx.mbeanserver.jmxmbeanserver.invoke(jmxmbeanserver.java:801) @ org.apache.catalina.manager.managerservlet.check(managerservlet.java:1460) @ org.apache.catalina.manager.htmlmanagerservlet.upload(htmlmanagerservlet.java:289) @ org.apache.catalina.manager.htmlmanagerservlet.dopost(htmlmanagerservlet.java:210) @ javax.servlet.http.httpservlet.service(httpservlet.java:648) @ javax.servlet.http.httpservlet.service(httpservlet.java:729) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:291) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.filters.csrfpreventionfilter.dofilter(csrfpreventionfilter.java:213) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.filters.setcharacterencodingfilter.dofilter(setcharacterencodingfilter.java:108) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:219) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:106) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:614) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:142) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) @ org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:88) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:518) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1091) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:668) @ org.apache.coyote.http11.http11nioprotocol$http11connectionhandler.process(http11nioprotocol.java:223) @ org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1517) @ org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1474) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(thread.java:745) caused by: java.lang.noclassdeffounderror: [lorg/hibernate/engine/filterdefinition; @ java.lang.class.getdeclaredmethods0(native method) @ java.lang.class.privategetdeclaredmethods(class.java:2615) @ java.lang.class.privategetpublicmethods(class.java:2733) @ java.lang.class.getmethods(class.java:1472) @ org.springframework.beans.extendedbeaninfofactory.supports(extendedbeaninfofactory.java:54) @ org.springframework.beans.extendedbeaninfofactory.getbeaninfo(extendedbeaninfofactory.java:46) @ org.springframework.beans.cachedintrospectionresults.<init>(cachedintrospectionresults.java:270) @ org.springframework.beans.cachedintrospectionresults.forclass(cachedintrospectionresults.java:189) @ org.springframework.beans.beanwrapperimpl.getcachedintrospectionresults(beanwrapperimpl.java:328) @ org.springframework.beans.beanwrapperimpl.getpropertydescriptorinternal(beanwrapperimpl.java:360) @ org.springframework.beans.beanwrapperimpl.iswritableproperty(beanwrapperimpl.java:440) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applypropertyvalues(abstractautowirecapablebeanfactory.java:1479) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.populatebean(abstractautowirecapablebeanfactory.java:1222) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:537) ... 60 more caused by: java.lang.classnotfoundexception: org.hibernate.engine.filterdefinition @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1305) @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1157) ... 74 more
maven:
<dependency> <groupid>org.springframework</groupid> <artifactid>spring-orm</artifactid> <version>4.1.6.release</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>4.3.8.final</version> </dependency>
my hibernate.cfg.xml:
<?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration system "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.current_session_context_class">thread</property> <property name="hibernate.default_schema">public</property> <!-- jdbc connection pool (use built-in) --> <property name="connection.pool_size">1</property> <property name="hibernate.transaction.auto_close_session">false</property> <!-- sql dialect --> <property name="dialect">org.hibernate.dialect.h2dialect</property> <!-- disable second-level cache --> <property name="cache.provider_class">org.hibernate.cache.internal.nocacheprovider</property> <!-- echo executed sql stdout --> <property name="show_sql">true</property> <!-- drop , re-create database schema on startup --> <property name="hbm2ddl.auto">create</property> <mapping resource="/web-inf/hibernateconf/app1user.hbm.xml"/> </session-factory> </hibernate-configuration>
can understand problem. , seee exception /web-inf/hibernateconf/app1user.hbm.xml not found well. related issue? problem?
Comments
Post a Comment