Tomcat启动时出现org.hibernate.cache.NoCachingEnabledException

  从vendor那里拿到了他们给我们公司项目写的project 代码,自己在部署的时候出现了问题。

 

 

ERROR (CommonsLoggingOutput.java:83)|Error loading class for creator 'SpringCreator[ApImportManager]'.

   org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/cashmanage/returnMoneyAction' defined in ServletContext resource [/WEB-INF/classes/config/spring/applicationContext-lw.xml]: Cannot resolve reference to bean 'productKindManage' while setting bean property 'productKindManage'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productKindManage' defined in ServletContext resource [/WEB-INF/classes/confi <script src="/javascripts/tinymce/themes/advanced/langs/zh.js" type="text/javascript"></script><script src="/javascripts/tinymce/plugins/javaeye/langs/zh.js" type="text/javascript"></script> g/spring/applicationContext-lw.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/classes/config/spring/applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/config/spring/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]

 

 

org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]

at org.hibernate.cache.impl.NoCachingRegionFactory.buildTimestampsRegion(NoCachingRegionFactory.java:79)

at org.hibernate.cache.UpdateTimestampsCache.<init>(UpdateTimestampsCache.java:58)

at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:379)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)

at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:822)

at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:748)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1099)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:400)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:182)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1054)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:863)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:382)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:182)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1054)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:863)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:382)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:182)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1054)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:863)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:382)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:283)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:321)

at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139)

at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:252)

at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:190)

at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:83)

at javax.servlet.GenericServlet.init(GenericServlet.java:212)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)

at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)

at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4348)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)

at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)

at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

at org.apache.catalina.core.StandardService.start(StandardService.java:516)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

at org.apache.catalina.startup.Catalina.start(Catalina.java:566)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

 

 

打电话咨询了vendor,他们没有使用二级缓存技术。

google之,尝试了在hibernate.cfg.xml 里面添加    

<property name="hibernate.cache.use_second_level_cache">false</property>

<property name="hibernate.cache.use_query_cache">false</property>

还是一样的异常。

 

 

现在我怀疑是不是二级缓存的问题还是别的。

 

2个回答

在大致会出错的地方设置断点,调试观察一下,看看问题根源在哪里。

[code="java"]
org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory
[/code]
在这里设置断点跟踪一下。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问