严重: 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 ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingNotFoundException: resource: ./TbNote.hbm.xml not found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403)
……
         ……
Caused by: org.hibernate.MappingNotFoundException: resource: ./TbNote.hbm.xml not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:610)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1491)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:642)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1400)
... 36 more
2011-3-17 14:35:36 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2011-3-17 14:35:36 org.apache.catalina.core.StandardContext start
严重: Context [/bookshop] startup failed due to previous errors
2011-3-17 14:35:36 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2011-3-17 14:35:36 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: A web application registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
我刚学习ssh不大明白,我看写的是TbNote.hbm.xml not found可是我看我这个路径写的没错啊!而且是myeclipse自动生成的

解决方案 »

  1.   

    applicationContext.xml:
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="configLocation"
    value="classpath:hibernate.cfg.xml">
    </property>
    </bean>
    <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName"
    value="com.mysql.jdbc.Driver">
    </property>
    <property name="url"
    value="jdbc:mysql://localhost:3306/bookstoer">
    </property>
    <property name="username" value="root"></property>
    <property name="password" value="123456"></property>
    <property name="poolPreparedStatements" value="true" />
    <property name="defaultAutoCommit" value="false" />
    </bean>
    <bean id="SessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.MySQLDialect
    </prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>com/bookshop/moder/TbNote.hbm.xml</value>
    </list>
    </property>
    </bean>
    TbNote.hbm.xml文件放在了com.bookshop.moder包里,部署好后我看到WEB-INF\classes\com\bookshop\moder文件夹下有TbNote.hbm.xml文件
      

  2.   

    org.hibernate.MappingNotFoundException: resource: 
    TbNote.hbm.xml not found找下是不是有这个hibernate 类配置文件
      

  3.   

    我改了改现在又报:
    严重: Servlet.service() for servlet jsp threw exception
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' is defined
    到底怎么回事啊?本人真实搞不明白啊?请大侠指教!!