2009-8-4 10:50:36 org.apache.catalina.startup.HostConfig checkResources
信息: Reloading context [/hd]
2009-8-4 10:50:37 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2009-8-4 10:50:40 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 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingNotFoundException: resource: com/whda/entity/Immobility.hbm.xml not found
Caused by: org.hibernate.MappingNotFoundException: resource: com/whda/entity/Immobility.hbm.xml not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:563)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1443)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:634)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:134)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1198)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1167)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:245)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Unknown Source)
2009-8-4 10:50:40 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2009-8-4 10:50:40 org.apache.catalina.core.StandardContext start
严重: Context [/hd] startup failed due to previous errors
2009-8-4 10:50:40 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext从字面上看是警告我的"创建sessionFactory找不到类的路径"
然后说在com/whda/entity/Immobility路径下找不到这个东西applicationContext.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<!-- 配置spring资源库 -->
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>com.whhd.hd.struts.ApplicationResources</value>
</property>
</bean> <bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<!-- DAO -->
<bean id="ImmobilityDAO" class="com.whhd.dao.ImmobilityDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="HdmainDAO" class="com.whhd.dao.HdmainDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="ManhourDAO" class="com.whhd.dao.ManhourDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean> <!-- BIZ -->
<bean id="ihmainIBiz" class="com.whhd.biz.IHmainImpl">
<property name="hdmainDAO">
<ref bean="HdmainDAO"/>
</property>
</bean>
<bean id="ImmobilityBiz" class="com.whhd.biz.ImmobilityImpl">
<property name="immobility">
<ref bean="ImmobilityDAO"/>
</property>
</bean>
<bean id="ManhourBiz" class="com.whhd.biz.ManhourImpl">
<property name="manhour">
<ref bean="ManhourDAO" />
</property>
</bean>
<!-- ACTION -->

<bean name="/hdmain" class="com.whhd.struts.action.HdmainAction">
<property name="iHmainBiz">
<ref bean="ihmainIBiz"/>
</property>
<property name="immobilityBiz">
<ref bean="ImmobilityBiz"/>
</property>
<property name="manhourBiz">
<ref bean="ManhourBiz"/>
</property>
</bean>
</beans>
web文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="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/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 <!-- 配置spring标签库 -->
<jsp-config>
<taglib>
<taglib-uri>/spring</taglib-uri>
<taglib-location>/WEB-INF/spring.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/spring-form</taglib-uri>
<taglib-location>/WEB-INF/spring-form.tld</taglib-location>
</taglib>
</jsp-config>
<!-- 加载spring -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>  <servlet>
   <servlet-name>dwr</servlet-name>
   <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
   <init-param>
   <param-name>debug</param-name>
   <param-value>true</param-value>
   </init-param>
  </servlet>
  
  <servlet-mapping>
   <servlet-name>dwr</servlet-name>
   <url-pattern>/dwr/*</url-pattern>
  </servlet-mapping> 
  
  <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>
    
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>这个是什么原因哈

解决方案 »

  1.   

    没有配置hibernateORM文件的路径
    MappingNotFoundException: resource: com/whda/entity/Immobility.hbm.xml 
    第二:
    应该配置数据
      

  2.   

    com/whda/entity/Immobility.hbm.xml这个路径出问题"org.springframework.orm.hibernate3.LocalSessionFactoryBean"这里可能出现包的问题也会出问题
      

  3.   

    应该是你hibernate.cfg.xml文件中引用Immobility.hbm.xml这个ORM文件出错了吧。看一下你配置这个mapping-resource没,或是你这个文件写没
      

  4.   

    Immobility.hbm.xml是在entity里下的,跟bean一起系统生成的 
    当时用DB Browser反转数据库 hibernate 生成的
      

  5.   


    asm2.2.3jar这个包很早就删了..这个路径没有问题 :-)
      

  6.   

    hiernate文件
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC
              "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
              "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools.                   -->
    <hibernate-configuration><session-factory>
    <property name="connection.username">sa</property>
    <property name="connection.url">
    jdbc:sqlserver://localhost:1433;databaseName=hd
    </property>
    <property name="dialect">
    org.hibernate.dialect.SQLServerDialect
    </property>
    <property name="myeclipse.connection.profile">sql2005</property>
    <property name="connection.password">leon</property>
    <property name="connection.driver_class">
    com.microsoft.sqlserver.jdbc.SQLServerDriver
    </property>
    <property name="show_sql">true</property>
    <property name="connection.autocommit">ture</property>
    <mapping resource="com/whda/entity/Immobility.hbm.xml" />
    <mapping resource="com/whda/entity/Hdmain.hbm.xml" />
    <mapping resource="com/whda/entity/Manhour.hbm.xml" /></session-factory></hibernate-configuration>
      

  7.   

        <mapping resource="com/whda/entity/Immobility.hbm.xml" />
    这个文件肯定是有的.因为在你的工程里可以看到,不用说了.但在CLASS目录下的包里有没有呢?有时候部署时有些文件没有复制过去.
      

  8.   

    我觉得是不是 WEB.XML的问题.....
      

  9.   

    你的配置有问题在SSH框架中  例如 在hibernate.cfg.xml 中
    <mapping  resource="com/wootion/bpm/database/xml/TBpmColumnControl.hbm.xml" />
    那么在applicationContext.xml 他就要接管映射
     <property name="mappingResources">
    <list><value>
    com/wootion/bpm/database/xml/TBpmColumnControl.hbm.xml
          </value>
    </list>
    </property>
    所以不可以再亮哥文件中都接管映射 一般是采用spring接管 所以就把hibernate的注释掉 看看行不行
      

  10.   

    你这样写应当是用mappingResources吧
      

  11.   

    恩  ?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans>
    <!--Oracle Driver DBCP--> <bean id="DataSource"
    class="org.apache.commons.dbcp.BasicDataSource"
    destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url"
    value="jdbc:mysql://127.0.0.1:3306/sma?useUnicode=true&amp;characterEncoding=GBK" />
    <!--<property name="url" value="jdbc:oracle:thin:@211.138.112.212:1521:SMCP" />   
    -->
    <property name="username" value="cst" />
    <property name="password" value="cstsoft" />
    <property name="initialSize" value="10" /><!-- 初始化连接:连接池启动时创建的初始化连接数量,1.2版本后支持 -->
    <property name="maxActive" value="40" /><!-- 连接池的最大数据库连接数,设为0表示无限制 -->
    <property name="maxIdle" value="30" />
    <!-- 数据库连接的最大空闲时间。超过此空闲时间,数据库连接将被标记为不可用,然后被释放。设为0表示无限制 -->
    <property name="maxWait" value="10000" />
    <!-- 最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制 -->
    <property name="defaultAutoCommit" value="false" />
    <property name="removeAbandoned" value="true" />
    <!-- 回收被遗弃的(一般是忘了释放的)数据库连接到连接池中 -->
    <property name="removeAbandonedTimeout" value="30" />
    <!-- 数据库连接过多长时间不用将被视为被遗弃而收回连接池中 -->
    <property name="logAbandoned" value="true" />
    <!-- 将被遗弃的数据库连接的回收记入日志 -->
    </bean> <!--
    <bean id="DataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName">
    <value>com.mysql.jdbc.Driver</value>
    </property>
    <property name="url">
    <<<<<<< applicationContext.xml
    <value>jdbc:mysql://127.0.0.1:3306/wt_moa?useUnicode=true&amp;characterEncoding=GBK</value>
    =======
    <value>
    jdbc:mysql://10.130.40.222:3306/wt_moa?useUnicode=true&amp;characterEncoding=GBK
    </value>
    >>>>>>> 1.7
    </property>
    <property name="username">
    <value>mysql</value>
    </property>
    <property name="password">
    <value>zxumamysql</value>
    </property>
    </bean>

    <bean id="DataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName">
    <value>oracle.jdbc.driver.OracleDriver</value>
    </property>
    <property name="url">
    <value>jdbc:oracle:thin:@10.130.40.253:1521:study</value>
    </property>
    <property name="username">
    <value>bmp01</value>
    </property>
    <property name="password">
    <value>bmp01</value>
    </property>
    </bean>
    --> <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="DataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.query.factory_class">
    org.hibernate.hql.classic.ClassicQueryTranslatorFactory
    </prop>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.MySQLDialect
    <!-- org.hibernate.dialect.SQLServerDialect
    org.hibernate.dialect.Oracle9Dialect-->
    </prop>
    <prop key="hibernate.show_sql">true</prop>
    <!--
    <prop key="hibernate.dialect">${xf_dbdialect}</prop>
    <prop key="hibernate.show_sql">${xf_showsql}</prop>
    <prop key="hibernate.format_sql">${xf_formatsql}</prop>

    <prop key="connection.pool_size">10</prop>
    <prop key="default_batch_fetch_size">50</prop>
    <prop key="max_fetch_depth">5</prop>
    <prop key="cache.use_query_cache">true</prop>
    -->
    </props>
    </property>
    <property name="mappingResources">
    <list> <value>
    com/wootion/idp/database/xml/TblUserR.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TblRoteR.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TblGroupR.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TblPrivR.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TblRightR.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TblColumnR.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TblColumnB.hbm.xml
    </value>
    <!--  <value>
    com/wootion/idp/database/xml/TBmpDic.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TBmpDictp.hbm.xml
    </value>-->
    <value>
    com/wootion/idp/database/xml/TIdpUser.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TPosi.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TDept.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TBmpAnnex.hbm.xml
    </value>
    <value>com/wootion/idp/database/xml/TU2p.hbm.xml</value>
    <value>com/wootion/idp/database/xml/TU2d.hbm.xml</value>
    <value>
    com/wootion/idp/database/xml/TSpecialroleCategory.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TBmpManager.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TSpecialrole.hbm.xml
    </value>
    <value>
    com/wootion/idp/database/xml/TblNewsB.hbm.xml
    </value>
    <!--未加表数据关联  <value>com/wootion/idp/database/bpm/xml/TBpmPd.hbm.xml</value>
    <value>com/wootion/idp/database/bpm/xml/TBpmShow.hbm.xml</value>
    <value>com/wootion/idp/database/bpm/xml/TBpmWf.hbm.xml</value>
    <value>com/wootion/idp/database/bpm/xml/TBpmWfLog.hbm.xml</value>

    <value>
    com/wootion/bpm/database/xml/TBpmAnnex.hbm.xml
    </value>-->
    <value>
    com/wootion/bpm/database/xml/TBpmPd.hbm.xml
    </value>
    <value>
    com/wootion/bpm/database/xml/TBpmShow.hbm.xml
    </value>
    <value>
    com/wootion/bpm/database/xml/TBpmWf.hbm.xml
    </value>
    <value>
    com/wootion/bpm/database/xml/TBpmWfLog.hbm.xml
    </value>
    <value>
    com/wootion/bpm/database/xml/TBpmWfAu.hbm.xml
    </value>
    <value>
    com/wootion/bpm/database/xml/TBpmTaskplan.hbm.xml
    </value> <value>
    com/wootion/bpm/database/xml/TBpmInpect.hbm.xml
    </value>
    <value>
    com/wootion/bpm/database/xml/TBpmTask.hbm.xml
    </value>
    <value>
    com/wootion/bpm/database/xml/TBpmPooltask.hbm.xml
    </value>
    <value>
    com/cst/xzmobile/common/database/xml/TBmpDic.hbm.xml
    </value>
    <value>
    com/cst/xzmobile/common/database/xml/TBmpDictp.hbm.xml
    </value>
    <value>
    com/cst/xzmobile/common/database/xml/TWf.hbm.xml
    </value>
    <value>
    com/cst/xzmobile/opeaudit/database/xml/TBmpOpeaudit.hbm.xml
    </value>
    <value>
    com/cst/xzmobile/opeaudit/database/xml/TWContOpeaudit.hbm.xml
    </value>
    <value>
    com/cst/xzmobile/opeaudit/database/xml/TWLogOpeaudit.hbm.xml
    </value>
    <value>
        com/cst/xzmobile/mtweekly/database/xml/TBmpMtweekly.hbm.xml
    </value>
    <value>
        com/cst/xzmobile/mtweekly/database/xml/TBmpMtannex.hbm.xml
    </value>
    <value>
       com/cst/xzmobile/mtweekly/database/xml/TBmpMtdept.hbm.xml
    </value>
    <value>
       com/cst/xzmobile/testent/database/xml/TBmpTestent.hbm.xml
    </value>
    <value>
       com/cst/xzmobile/testent/database/xml/TWContTestent.hbm.xml
    </value>
    <value>
      com/cst/xzmobile/testent/database/xml/TWLogTestent.hbm.xml
    </value>
    <value>
    com/cst/xzmobile/testent/database/xml/TBmpTestdata.hbm.xml
    </value>
    </list>
    </property>
    我的applicationContext.xml
      

  12.   

    虽然这个方法不报这个错了,但是
    一发布点tomcat 后 就弹出个 getDeclaredConstructors0 貌似是 跟 debug 一样的东西
    又不弹出错误,这个是 什么回事呀
    是不是 因为hiernate先结果的映射 而把里面的路径改到了applicationContext0里来了  所有 没有映射 的原因哈, 如何 映射到 applicationContext0 呢?
      

  13.   

    spring 集成HIBERNATE,两种配置文件都可以,LS 当配置文件相当多时,你觉得放一个文件里 合适?
    LZ的配置在HIBERNATE.CFG.XML也可以啊.解析时也是一样的
      

  14.   

    但是为什么弹出
    Error creating bean with name 'sessionFactory' defined in class path resource
    创建seesionFactory失败
    并且下一句是
    resource: com/whda/entity/Immobility.hbm.xml not found
    没有找到 这个文件..
    我hiernate里 明明有 这个文件,是怎么回事呀<?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC
              "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
              "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools.                   -->
    <hibernate-configuration><session-factory>
        <property name="connection.username">sa</property>
        <property name="connection.url">
            jdbc:sqlserver://localhost:1433;databaseName=hd
        </property>
        <property name="dialect">
            org.hibernate.dialect.SQLServerDialect
        </property>
        <property name="myeclipse.connection.profile">sql2005</property>
        <property name="connection.password">leon</property>
        <property name="connection.driver_class">
            com.microsoft.sqlserver.jdbc.SQLServerDriver
        </property>
        <property name="show_sql">true</property>
        <property name="connection.autocommit">ture</property>
        <mapping resource="com/whda/entity/Immobility.hbm.xml" />
        <mapping resource="com/whda/entity/Hdmain.hbm.xml" />
        <mapping resource="com/whda/entity/Manhour.hbm.xml" /></session-factory></hibernate-configuration>
      

  15.   

    不晓得你解决没
    我跟你遇到一样的情况 ssh时有重复的包
     删除 asm.jar 
                 asm-attrs.jar 
         cglib-nodep-2.1.3.jar 
         commons-cllections-2.1.1.jar 
      

  16.   

    我是因为actionform中的一个属性写错了,产生的这种情况。你检查一下你的是不是这种情况;
      

  17.   

    你把hbm文件放在entity包中吗?如果是的,我也不知道怎么改,
    如果放在hbm包中,就请把<mapping resource="com/whda/entity/Immobility.hbm.xml" />
    的entity改成hbm