当前位置: 代码迷 >> J2EE >> 整合spring时,启动tomcat出现异常
  详细解决方案

整合spring时,启动tomcat出现异常

热度:77   发布时间:2016-04-22 02:11:32.0
整合spring时,启动tomcat出现错误
整合spring时,启动tomcat出现错误,访问项目都是404错误,也就是说项目没有部署成功。都调试了几天了,一直没有解决,诚心求朋友帮帮忙,谢谢!
首先我的SSH包没有错误,把我的SSH包作为其他项目的额包能够正常运行。

beans.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:context="http://www.springframework.org/schema/context"    xmlns:aop="http://www.springframework.org/schema/aop"    xmlns:tx="http://www.springframework.org/schema/tx"    xsi:schemaLocation="http://www.springframework.org/schema/beans           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd           http://www.springframework.org/schema/context           http://www.springframework.org/schema/context/spring-context-3.0.xsd           http://www.springframework.org/schema/aop           http://www.springframework.org/schema/aop/spring-aop-3.0.xsd           http://www.springframework.org/schema/tx            http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">    <context:annotation-config />    <context:component-scan base-package="com.maomao" />    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">        <property name="locations">            <value>classpath:jdbc.properties</value>        </property>    </bean>    <bean id="dataSource" destroy-method="close"        class="org.apache.commons.dbcp.BasicDataSource">        <property name="driverClassName"            value="${jdbc.driverClassName}" />        <property name="url" value="${jdbc.url}" />        <property name="username" value="${jdbc.username}" />        <property name="password" value="${jdbc.password}" />    </bean>    <bean id="sessionFactory"        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">        <property name="dataSource" ref="dataSource" />        <property name="packagesToScan">            <list>                <value>com.maomao.model</value>            </list>        </property>        <property name="hibernateProperties">            <value>                   hibernate.dialect=org.hibernate.dialect.MySQLDialect                   hibernate.show_sql=true                   hibernate.format_sql=true                   hibernate.hbm2ddl.auto=update                   javax.persistence.validation.mode=none             </value>        </property>    </bean>    <bean id="txManager"        class="org.springframework.orm.hibernate3.HibernateTransactionManager">        <property name="sessionFactory" ref="sessionFactory" />    </bean>        <tx:annotation-driven transaction-manager="txManager"/>        <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">        <property name="sessionFactory" ref="sessionFactory"></property>    </bean>    </beans>


struts.xml
XML code
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"    "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>    <constant name="struts.enable.DynamicMethodInvocation" value="true" />    <constant name="stuts.i18n.encoding" value="UTF-8"></constant>    <constant name="struts.devMode" value="true" />        <package name="user" namespace="/" extends="struts-default">              <interceptors>              <interceptor name="LoginInterceptor" class="com.maomao.interceptor.LoginInterceptor"></interceptor>         </interceptors>                   <global-results>              <result name="login" type="redirect">/index.jsp</result>              <result name="error" type="redirect">/login.jsp</result>              <result name="logout" type="redirect">/login.jsp</result>          </global-results>         <action name="user" class="com.maomao.action.UserAction" >            <result type="redirect">                /user.jsp            </result>        </action>       <!--           <action name="score_*" class="com.maomao.action.ScoreAction" method="{1}">            <result type="redirect">                /score_{1}.jsp            </result>        </action>            -->               </package>  <!--      <package name="admin" namespace="/admin" extends="struts-default">              <interceptors>              <interceptor name="LoginInterceptor" class="com.maomao.interceptor.LoginInterceptor"></interceptor>         </interceptors>                   <global-results>              <result name="login" type="redirect">/admin/index.jsp</result>              <result name="error" type="redirect">/admin/login.jsp</result>              <result name="logout" type="redirect">/admin/login.jsp</result>          </global-results>         <action name="user_*" class="com.maomao.action.UserAction" method="{1}">            <result type="redirect">                /user_{1}.jsp            </result>        </action>                 <action name="score_*" class="com.maomao.action.ScoreAction" method="{1}">            <result type="redirect">                /score_{1}.jsp            </result>              </package>  -->        <!-- Add packages here --></struts>