首页 新闻 会员 周边 捐助

ssh整合启动tomcat报错

0
悬赏园豆:15 [已解决问题] 解决于 2017-02-08 13:57

 

严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeDao' defined in file [D:\zWorkspace\ssh\ssh\WEB-INF\classes\applicationContext-beans.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 file [D:\zWorkspace\ssh\ssh\WEB-INF\classes\applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/context/spi/CurrentSessionContext
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1158)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
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:628)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at 
下面有剩下的错误信息
 1 org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
 2 at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
 3 at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
 4 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)
 5 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
 6 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
 7 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
 8 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
 9 at java.util.concurrent.FutureTask.run(Unknown Source)
10 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
11 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
12 at java.lang.Thread.run(Unknown Source)
13 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\zWorkspace\ssh\ssh\WEB-INF\classes\applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/context/spi/CurrentSessionContext
14 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
15 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
16 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
17 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
18 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
19 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
20 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
21 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323)
22 ... 24 more
23 Caused by: java.lang.NoClassDefFoundError: org/hibernate/context/spi/CurrentSessionContext
24 at java.lang.ClassLoader.defineClass1(Native Method)
25 at java.lang.ClassLoader.defineClass(Unknown Source)
26 at java.security.SecureClassLoader.defineClass(Unknown Source)
27 at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3196)
28 at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
29 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
30 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
31 at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.<init>(LocalSessionFactoryBuilder.java:107)
32 at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:278)
33 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
34 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
35 ... 31 more
36 Caused by: java.lang.ClassNotFoundException: org.hibernate.context.spi.CurrentSessionContext
37 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
38 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
39 ... 42 more
40 
41 一月 12, 2017 3:07:31 下午 org.apache.catalina.core.StandardContext listenerStart
42 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
43 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeDao' defined in file [D:\zWorkspace\ssh\ssh\WEB-INF\classes\applicationContext-beans.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 file [D:\zWorkspace\ssh\ssh\WEB-INF\classes\applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/context/spi/CurrentSessionContext
44 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329)
45 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
46 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1417)
47 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1158)
48 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
49 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
50 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
51 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
52 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
53 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
54 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
55 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
56 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
57 at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
58 at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
59 at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
60 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)
61 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
62 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
63 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
64 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
65 at java.util.concurrent.FutureTask.run(Unknown Source)
66 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
67 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
68 at java.lang.Thread.run(Unknown Source)
69 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\zWorkspace\ssh\ssh\WEB-INF\classes\applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/context/spi/CurrentSessionContext
70 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
71 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
72 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
73 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
74 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
75 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
76 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
77 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323)
78 ... 24 more
79 Caused by: java.lang.NoClassDefFoundError: org/hibernate/context/spi/CurrentSessionContext
80 at java.lang.ClassLoader.defineClass1(Native Method)
81 at java.lang.ClassLoader.defineClass(Unknown Source)
82 at java.security.SecureClassLoader.defineClass(Unknown Source)
83 at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3196)
84 at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
85 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
86 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
87 at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.<init>(LocalSessionFactoryBuilder.java:107)
88 at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:278)
89 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
90 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
91 ... 31 more
92 Caused by: java.lang.ClassNotFoundException: org.hibernate.context.spi.CurrentSessionContext
93 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
94 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
95 ... 42 more
96 
97 一月 12, 2017 3:07:31 下午 org.apache.catalina.core.StandardContext startInternal
98 严重: One or more listeners failed to start. Full details will be found in the appropriate container log file
View Code

 

 

 

问题补充:
View Code

这是我的applicationContext-beans.xml的配置文件,而且其中EmployeeDao.java文件是存在的。

这个ssh整合demo是按照网上尚硅谷的视频做的,不知道怎么就报错了。

求大神帮帮忙啊

看你灬梨涡浅笑的主页 看你灬梨涡浅笑 | 初学一级 | 园豆:96
提问于:2017-01-12 15:09
< >
分享
最佳答案
0

找找有没有这个class Caused by: java.lang.ClassNotFoundException: org.hibernate.context.spi.CurrentSessionContext

少包吧

收获园豆:15
让我发会呆 | 老鸟四级 |园豆:2929 | 2017-01-12 15:36

没有少。。。复制的项目。。。

已经解决了,就是hibernate连接数据库配置了,然后Spring配置文件中又配置了一次,删一个地方就可以了

看你灬梨涡浅笑 | 园豆:96 (初学一级) | 2017-01-12 16:51
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册