2 u013485206 u013485206 于 2016.03.22 16:07 提问

spring和hibernate整合出错,请大神帮忙解决,谢谢

<!-- Hibernate和spring整合的配置 配置SessionFactory -->

<!-- 指定hibernate的配置文件位置 -->

<!-- 配置c3p0数据库连接池 -->

<!--通过反射设置set方法-->
<!-- 数据连接信息 -->




<!-- 其他配置 -->
<!-- 初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间,default:3 -->

<!-- 连接池中保留的最小连接数,default=3 -->

<!-- 连接池中保留的最大连接数,default=15 -->

<!-- 当连接池中的连接耗尽的时候o3p0一次同时获取的连接数,default=3 -->

<!-- 控制数据源内加载的PreparedStatement数量,如果maxStatement与maxStatementPerConnection均为0,则缓存被关闭,default:0 -->


</bean>




以上是配置信息,启动Tomcat时报以下错误
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Post-processing failed of bean type [class org.springframework.orm.hibernate3.LocalSessionFactoryBean] failed; nested exception is java.lang.IllegalStateException: Failed to introspect bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean] for persistence metadata: could not find class that it depends on
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:875)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:495)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:610)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.IllegalStateException: Failed to introspect bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean] for persistence metadata: could not find class that it depends on
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:396)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:333)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:870)
... 36 more
Caused by: java.lang.NoClassDefFoundError: Lorg/hibernate/cache/RegionFactory;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredFields(Class.java:1743)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:411)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:392)
... 38 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.RegionFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 43 more

1个回答

revolversgod
revolversgod   2016.03.22 17:02
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
求助打印预览的问题!
请帮忙解决,谢谢! 请帮忙解决,谢谢! 请帮忙解决,谢谢! 请帮忙解决,谢谢! 请帮忙解决,谢谢!
安装出错图片
安装出错图片,请大家帮忙解决
Struts2+Hibernate+Spring整合步骤
1.Spring 整合Hibernate整合什么? 1.由IOC容器来管理Hibernate的SessionFactory 2.让Hibernate使用上Spring的声明式事务 2.整合步骤: 1.加入Hibernate  1)jar包 2)添加Hibernate配置文件 hibernate.cfg.xml a.数据源需配置在IOC容器中,不再hibernate.cfg.xml
使用struts、hibernate、spring进行框架整合流程详细说明
SSH框架应用非常广泛,是目前较流行的一种Web应用程序开源框架。很多公司很多项目都会用到这3种框架,那么如何正确规范的使用这三种框架开发实际的项目呢?下面介绍struts、hibernate、spring的整合流程:
Spring整合Web,Mybatis,Hibernate
一.Spring整合web 1.添加jar IOC+AOP spring-web.jar 2.web.xml配置文件 <!-- 配置访问默认主页 -->   welcome-file-list>     welcome-file>/public/index.htmlwelcome-file>   welcome-file-list> 与web的整合读取appli
Spring+Hibernate整合开发配置,完整实例
hibernate spring 配置
深入了解Spring4整合Hibernate4时的No Session异常的原理与解决方案
深入了解Spring4整合Hibernate4时的No Session异常的原理与解决方案
SSH整合——spring跟hibernate兼容问题
BUG描述: Could not open Hibernate Session for transaction; nested exception is java.lang.NoClassDefFoundError: org/hibernate/engine/transaction/spi/TransactionContext解决过程: 发现可能是版本兼容问题,我用的是spring4.0.3,h
Spring与Hibernate整合小细节与测试问题
Spring与Hibernate整合问题小解:Spring和Hibernate支持添加顺序;整合配合文件中配置事务:声明式事务配置;类注册的两种方式有值注入和无值注入;SessionFactory注入详解;测试时小问题
Spring+Hibernate整合时关于Hibernate事务管理的问题
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' mark