首页 新闻 会员 周边 捐助

SSH框架生成sessionFactory异常

0
悬赏园豆:20 [已关闭问题] 关闭于 2016-09-10 13:57

我最先配置的ssh框架已经调试完毕是没有问题的, 但是我复制一份,改了项目的名称,然后再编译就出现了下面的问题,希望哪位大神能帮我解决一下,感激不尽

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [cn/ahnu/vo/Equipment.hbm.xml] cannot be opened because it does not exist
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:589)
 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:383)
 at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
 at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
 at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1975)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
 at java.util.concurrent.FutureTask.run(FutureTask.java:138)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.FileNotFoundException: class path resource [cn/ahnu/vo/Equipment.hbm.xml] cannot be opened because it does not exist
 at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:157)
 at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:680)
 at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
 ... 26 more
2016-9-9 10:39:45 org.apache.catalina.core.StandardContext startInternal
严重: One or more listeners failed to start. Full details will be found in the appropriate container log file
2016-9-9 10:39:45 org.apache.catalina.core.StandardContext startInternal
严重: Context [/SHOP] startup failed due to previous errors
2016-9-9 10:39:45 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2016-9-9 10:39:45 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tomcat\webapps\SHOP has finished in 12,969 ms
2016-9-9 10:39:45 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tomcat\webapps\SSHTest
2016-9-9 10:39:53 org.apache.catalina.startup.TldConfig execute
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2016-9-9 10:39:53 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
2016-9-9 10:39:53 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2016-9-9 10:40:05 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tomcat\webapps\SSHTest has finished in 19,855 ms
2016-9-9 10:40:05 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\tomcat\webapps\SSHShop
2016-9-9 10:40:12 org.apache.catalina.startup.TldConfig execute
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2016-9-9 10:40:12 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
2016-9-9 10:40:13 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2016-9-9 10:40:24 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\tomcat\webapps\SSHShop has finished in 18,914 ms
2016-9-9 10:40:24 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
2016-9-9 10:40:24 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
2016-9-9 10:40:24 org.apache.catalina.startup.Catalina start
信息: Server startup in 53553 ms

江城印象的主页 江城印象 | 初学一级 | 园豆:95
提问于:2016-09-09 10:47
< >
分享
所有回答(3)
0

经过测试,我发现如果想复制一个项目的框架,然后使用,要改变这个项目的数据库才能使用,不然就会报上面的错误。至于什么原理,我现在还没有搞清楚。

江城印象 | 园豆:95 (初学一级) | 2016-09-09 10:55
0

java.io.FileNotFoundException: class path resource [cn/ahnu/vo/Equipment.hbm.xml] cannot be opened because it does not exist 这个

laugher_ccc | 园豆:593 (小虾三级) | 2016-09-09 15:37
0

注入出错?

洒水閃人 | 园豆:210 (菜鸟二级) | 2016-09-09 16:32

这个我也不太清楚,复制完以后,直接运行,可能是因为多个项目连接同一个数据库,所以出错了吧

支持(0) 反对(0) 江城印象 | 园豆:95 (初学一级) | 2016-09-09 17:18
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册