信息: Starting Servlet Engine: Apache Tomcat/6.0.10
2010-9-23 16:33:36 org.apache.catalina.core.ApplicationContext log
信息: Loading Spring root WebApplicationContext
16:34:14,406 ERROR ContextLoader:205 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.support.DefaultPointcutAdvisor': Cannot resolve reference to bean 'txAdvice' while setting bean property 'advice'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txAdvice': 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 file [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.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 [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.Organization
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txAdvice': 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 file [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.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 [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.Organization
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.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 [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.Organization
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.Organization
Caused by: org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.Organization
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1249)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1167)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1283)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValuesorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized 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)
2010-9-23 16:34:14 org.apache.catalina.core.StandardContext listenerStart
严重: 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 'org.springframework.aop.support.DefaultPointcutAdvisor': Cannot resolve reference to bean 'txAdvice' while setting bean property 'advice'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txAdvice': 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 file [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.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 [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.Organization
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txAdvice': 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 file [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.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 [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.Organization
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.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 [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.Organization
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.Organization
Caused by: org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.Organization
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1249)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1167)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1283)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:798)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)

解决方案 »

  1.   

    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [C:\Documents and Settings\hp\workspace\OA\WebRoot\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.OrganizationCaused by: org.hibernate.MappingException: An association from the table t_person refers to an unmapped class: javax.xml.registry.infomodel.Organization异常这就有提示啊
      

  2.   

    web.xml中没有配置对spring的监听吧
      

  3.   

    web.xml 文件内容如下:spring监听已经配置了。
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      
      <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>
      </context-param>
      
      <filter>
       <filter-name>struts2</filter-name>
       <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
      </filter>
      
      <filter-mapping>
         <filter-name>struts2</filter-name>
         <url-pattern>/*</url-pattern>
      </filter-mapping>
      
      
     
      
      <listener>
         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>
      
      <filter>
        <filter-name>hibernateFilter</filter-name>
        <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
       </filter>
      <filter-mapping>
          <filter-name>hibernateFilter</filter-name>
          <url-pattern>*.action</url-pattern>
      </filter-mapping>
     
      <filter>
          <filter-name>encodingFilter</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>encodingFilter</filter-name>
           <url-pattern>/*</url-pattern>
      </filter-mapping>
    </web-app>
      

  4.   

     Cannot resolve reference to bean 'txAdvice' while setting bean property 'advice';bean设置错误.
    你一个一个设置.
    一个没有错误,再设置下一个.
      

  5.   

    配置下log4j 然后知道缺什么包
      

  6.   

    Bug已找到。Person.java 类中的包引用了javax.xml.registry.infomodel.Organization出错,应该引用自己包中类(com.oa.model.Oragnization)。还可以在Organization.hbm.xml中在many-to-one的元素中加入class="com.oa.model.Oragnization"语句。  希望有类似Bug的网友能有参考的作用。
      

  7.   

    txAdvice这个Bean有问题 t_person这个table也有问题。