一晚上都没搞出来
log4j报错如下:
[INFO ] 2009-07-15 23:04:44 Method:   org.springframework.web.struts.ContextLoaderPlugIn.init(ContextLoaderPlugIn.java:218)
ContextLoaderPlugIn for Struts ActionServlet 'action, module '': initialization started
 ???[INFO ] 2009-07-15 23:04:45 Method:   org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:163)
Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
 ???[INFO ] 2009-07-15 23:04:45 Method:   org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:92)
Bean factory for application context [WebApplicationContext for namespace 'action-servlet']: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,/user,sessionFactory,ProUserDAO]; root of BeanFactory hierarchy
 ???[INFO ] 2009-07-15 23:04:45 Method:   org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:297)
4 beans defined in application context [WebApplicationContext for namespace 'action-servlet']
 ???[INFO ] 2009-07-15 23:04:45 Method:   org.springframework.core.CollectionFactory.<clinit>(CollectionFactory.java:66)
JDK 1.4+ collections available
 ???[INFO ] 2009-07-15 23:04:45 Method:   org.springframework.core.CollectionFactory.<clinit>(CollectionFactory.java:71)
Commons Collections 3.x available
 ???[INFO ] 2009-07-15 23:04:45 Method:   org.springframework.context.support.AbstractApplicationContext.initMessageSource(AbstractApplicationContext.java:439)
Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@d1918a]
 ???[INFO ] 2009-07-15 23:04:45 Method:   org.springframework.context.support.AbstractApplicationContext.initApplicationEventMulticaster(AbstractApplicationContext.java:461)
Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@455aa8]
 ???[INFO ] 2009-07-15 23:04:45 Method:   org.springframework.ui.context.support.UiApplicationContextUtils.initThemeSource(UiApplicationContextUtils.java:84)
Unable to locate ThemeSource with name 'themeSource': using default [org.springframework.ui.context.support.ResourceBundleThemeSource@3f1179]
 ???[INFO ] 2009-07-15 23:04:45 Method:   org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:260)
Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,/user,sessionFactory,ProUserDAO]; root of BeanFactory hierarchy]
 ???[INFO ] 2009-07-15 23:04:46 Method:   org.hibernate.cfg.Environment.<clinit>(Environment.java:464)
Hibernate 3.0.5
 ???[INFO ] 2009-07-15 23:04:46 Method:   org.hibernate.cfg.Environment.<clinit>(Environment.java:477)
hibernate.properties not found
 ???[INFO ] 2009-07-15 23:04:46 Method:   org.hibernate.cfg.Environment.<clinit>(Environment.java:510)
using CGLIB reflection optimizer
 ???[INFO ] 2009-07-15 23:04:46 Method:   org.hibernate.cfg.Environment.<clinit>(Environment.java:540)
using JDK 1.4 java.sql.Timestamp handling
 ???[INFO ] 2009-07-15 23:04:46 Method:   org.springframework.beans.factory.support.AbstractBeanFactory.destroySingletons(AbstractBeanFactory.java:550)
Destroying singletons in factory {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,/user,sessionFactory,ProUserDAO]; root of BeanFactory hierarchy}
 ???[ERROR] 2009-07-15 23:04:46 Method:   org.springframework.web.struts.ContextLoaderPlugIn.init(ContextLoaderPlugIn.java:229)
Context initialization failed
 ???org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.io.FileNotFoundException: class path resource [com/struts/ProUser.hbm.xml] cannot be opened because it does not exist
java.io.FileNotFoundException: class path resource [com/struts/ProUser.hbm.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:137)

解决方案 »

  1.   

    ???org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.io.FileNotFoundException: class path resource [com/struts/ProUser.hbm.xml] cannot be opened because it does not exist报错报的很清楚,在applicationContext.xml里面定义的sessionFactory引用的ProUser.hbm.xml文件找不到,确定一下你放的路径是否正确