问题描述
13:18:35,886INFODefaultListableBeanFactory:282-Destroyingsingletonsinorg.springframework.beans.factory.support.DefaultListableBeanFactory@d5b111:definingbeans[dataSource,sessionFactory,transmanager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,pt,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor,VipUserDao,UserRankDao,VipService,/vipUser];rootoffactoryhierarchy13:18:35,889ERRORContextLoader:205-Contextinitializationfailedorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'sessionFactory'definedinServletContextresource[/WEB-INF/applicationContext.xml]:Invocationofinitmethodfailed;nestedexceptionisjava.io.FileNotFoundException:classpathresource[com/happygo/manager/entity/user/EcsUsers.hbm.xmlcom/happygo/manager/entity/user/EcsUserRank.hbm.xml]cannotbeopenedbecauseitdoesnotexistCausedby:java.io.FileNotFoundException:classpathresource[com/happygo/manager/entity/user/EcsUsers.hbm.xmlcom/happygo/manager/entity/user/EcsUserRank.hbm.xml]cannotbeopenedbecauseitdoesnotexistatorg.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:135)atorg.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:655)atorg.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:131)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1198)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1167)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)atorg.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)atorg.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4336)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)atorg.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)atorg.apache.catalina.core.StandardHost.start(StandardHost.java:719)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)atorg.apache.catalina.core.StandardService.start(StandardService.java:448)atorg.apache.catalina.core.StandardServer.start(StandardServer.java:710)atorg.apache.catalina.startup.Catalina.start(Catalina.java:552)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)2009-10-2913:18:35org.apache.catalina.core.StandardContextlistenerStart
解决方案
解决方案二:
009-10-2913:18:35org.apache.catalina.core.StandardContextlistenerStart严重:Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'sessionFactory'definedinServletContextresource[/WEB-INF/applicationContext.xml]:Invocationofinitmethodfailed;nestedexceptionisjava.io.FileNotFoundException:classpathresource[com/happygo/manager/entity/user/EcsUsers.hbm.xmlcom/happygo/manager/entity/user/EcsUserRank.hbm.xml]cannotbeopenedbecauseitdoesnotexistCausedby:java.io.FileNotFoundException:classpathresource[com/happygo/manager/entity/user/EcsUsers.hbm.xmlcom/happygo/manager/entity/user/EcsUserRank.hbm.xml]cannotbeopenedbecauseitdoesnotexistatorg.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:135)atorg.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:655)atorg.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:131)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1198)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1167)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)atorg.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)atorg.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4336)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)atorg.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)atorg.apache.catalina.core.StandardHost.start(StandardHost.java:719)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)atorg.apache.catalina.core.StandardService.start(StandardService.java:448)atorg.apache.catalina.core.StandardServer.start(StandardServer.java:710)atorg.apache.catalina.startup.Catalina.start(Catalina.java:552)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)2009-10-2913:18:35org.apache.catalina.core.StandardContextstart
解决方案三:
<beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.0.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.0.xsd"><beanid="dataSource"class="org.apache.commons.dbcp.BasicDataSource"><propertyname="driverClassName"value="com.mysql.jdbc.Driver"></property><propertyname="url"value="jdbc:mysql://127.0.0.1:3306/shop?useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull"></property><propertyname="username"value="root"></property><propertyname="password"value="ok"></property></bean><beanid="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><propertyname="dataSource"><refbean="dataSource"/></property><propertyname="hibernateProperties"><props><propkey="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop><propkey="hibernate.show_sql">true</prop><propkey="hibernate.format_sql">true</prop></props></property><propertyname="mappingResources"><list><value>com/happygo/manager/entity/user/EcsUsers.hbm.xmlcom/happygo/manager/entity/user/EcsUserRank.hbm.xml</value></list></property></bean><!--事务管理器--><beanid="transmanager"class="org.springframework.orm.hibernate3.HibernateTransactionManager"><propertyname="sessionFactory"ref="sessionFactory"></property></bean><!--事务通知--><tx:adviceid="txAdvice"transaction-manager="transmanager"><tx:attributes><tx:methodname="get*"propagation="SUPPORTS"read-only="true"/><tx:methodname="find*"propagation="SUPPORTS"read-only="true"/><tx:methodname="search*"propagation="SUPPORTS"read-only="true"/><tx:methodname="*"propagation="REQUIRED"/></tx:attributes></tx:advice><!--切面,通知者--><aop:config><aop:pointcutid="pt"expression="execution(*com.happygo.manager.service.*.*(..))"/><aop:advisoradvice-ref="txAdvice"pointcut-ref="pt"/></aop:config><!--VIPUsers--><!--DAO--><beanid="VipUserDao"class="com.happygo.manager.dao.user.impl.VipUserDao"><propertyname="sessionFactory"ref="sessionFactory"></property></bean><beanid="UserRankDao"class="com.happygo.manager.dao.user.impl.UserRankImpl"><propertyname="sessionFactory"ref="sessionFactory"></property></bean><!--service--><beanid="VipService"class="com.happygo.manager.service.user.impl.VipServiceImpl"><propertyname="vipUserDao"ref="VipUserDao"></property></bean><!--Action--><beanname="/vipUser"class="com.happygo.manager.web.struts.action.VipUserAction"><propertyname="vipService"ref="VipService"></property></bean></beans>
解决方案四:
找不到映射文件路径没错我试了好几种办法重新删除在部署删除asm2.13的扎包在Spring映射路径改成直接去找classpath也不行~求救啊小弟感谢万分
解决方案五:
把映射文件的具体位置和层次贴一下文件找不到,至少看起来是你路径写错了!
解决方案六:
src/com/happygo/manager/entity/user/EcsUserRank.hbm.xmlsrc/com/happygo/manager/entity/user/EcsUsers.hbm.xml属性路径~我都直接复制过来的怎么能错啊~。
解决方案七:
web.xml<?xmlversion="1.0"encoding="UTF-8"?><web-appxmlns="http://java.sun.com/xml/ns/j2ee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"version="2.4"xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><servlet><servlet-name>action</servlet-name><servlet-class>org.apache.struts.action.ActionServlet</servlet-class><init-param><param-name>config</param-name><param-value>/WEB-INF/struts-config.xml</param-value></init-param><init-param><param-name>debug</param-name><param-value>3</param-value></init-param><init-param><param-name>detail</param-name><param-value>3</param-value></init-param><load-on-startup>0</load-on-startup></servlet><servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping><!--Spring提供的中文过滤器--><filter><filter-name>charsetFitler</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>gbk</param-value></init-param></filter><filter-mapping><filter-name>charsetFitler</filter-name><url-pattern>*.do</url-pattern></filter-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>
解决方案八:
配置文件里改一下:原:<value>com/happygo/manager/entity/user/EcsUsers.hbm.xmlcom/happygo/manager/entity/user/EcsUserRank.hbm.xml</value>改成:<value>com/happygo/manager/entity/user/EcsUsers.hbm.xml</value><value>com/happygo/manager/entity/user/EcsUserRank.hbm.xml</value>
解决方案九:
OK了谢谢了太粗心了。。
解决方案十:
谢谢你了~万分感谢
解决方案十一:
呵呵,客气了。哥们,结贴吧
解决方案十二:
目前分数不够等我有分了把这个帖子给结了不好意思~啊
解决方案十三:
随便给我来点儿
解决方案十四:
引用7楼liwenso的回复:
配置文件里改一下:原:<value>com/happygo/manager/entity/user/EcsUsers.hbm.xmlcom/happygo/manager/entity/user/EcsUserRank.hbm.xml</value>改成:<value>com/happygo/manager/entity/user/EcsUsers.hbm.xml</value><value>com/happygo/manager/entity/user/EcsUserRank.hbm.xml</value>
没必要这样做,你在value里面加个list标签然后把你的映射文件放到标签里面就好了。
解决方案十五:
Causedby:java.io.FileNotFoundException:classpathresource[com/happygo/manager/entity/user/EcsUsers.hbm.xmlcom/happygo/manager/entity/user/EcsUserRank.hbm.xml]cannotbeopenedbecauseitdoesnotexist问题的关键所在