当前位置: 代码迷 >> Java Web开发 >> SSH整合有关问题
  详细解决方案

SSH整合有关问题

热度:102   发布时间:2016-04-17 10:59:03.0
SSH整合问题
报错:Error creating bean with name 'sessionFactory' defined in class path resource [DatabaseApplicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not parse mapping document in input stream

我就是从零开始搭建一个SSH的框架,没有实体类,只是写了一个返回success的action和一个对应的jsp页面,但在tomcat下运行一直报错,请大家帮忙看下,谢谢了
web.xml:
XML code
<?xml version="1.0" encoding="UTF-8"?><web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">    <!-- <display-name>SSO</display-name> -->    <!-- spring+hibernate -->      <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>/*</url-pattern>    </filter-mapping>    <!-- spring监听器 -->    <listener>        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>    </listener>    <listener>        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>    </listener>    <!-- struts核心控制 -->    <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>                        <!-- 数据库连接池 -->      <resource-ref>         <description>        </description>         <res-ref-name>SSOPool</res-ref-name>         <res-type>javax.sql.DataSource</res-type>         <res-auth>Container</res-auth>        <res-sharing-scope>Shareable</res-sharing-scope>     </resource-ref>          <!--  -->      <context-param>        <param-name>contextConfigLocation</param-name>        <param-value>/WEB-INF/applicationContext.xml</param-value>    </context-param>            <welcome-file-list>        <welcome-file>index.jsp</welcome-file>    </welcome-file-list>      </web-app>

applicationContext.xml:
XML code
<?xml version="1.0" encoding="UTF-8"?><beans    xmlns="http://www.springframework.org/schema/beans"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"    xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"    xsi:schemaLocation="            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd            http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">    <!--      <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">            <property name="driverClass" value="oracle.jdbc.driver.OracleDriver" />            <property name="jdbcUrl" value="jdbc:oracle:thin:@192.168.0.105:1521:gohigh" />            <property name="user" value="gohigh" />            <property name="password" value="admin"/>            <property name="maxIdleTime" value="1800" />    </bean>    -->    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">        <property name="jndiName">              <value>java:comp/env/SSOPool</value>        </property>    </bean>    <bean id="loginAction" class="com.sso.login.struts.action.LoginAction" scope="prototype" autowire="byName" />        <import resource="classpath:DatabaseApplicationContext.xml"/>    </beans>
  相关解决方案