当前位置: 代码迷 >> Java Web开发 >> spring struts2整合后tomcat启动错,页面404.解决方案
  详细解决方案

spring struts2整合后tomcat启动错,页面404.解决方案

热度:79   发布时间:2016-04-17 11:10:20.0
spring struts2整合后tomcat启动错,页面404.
我只整合spring和strurs2,页面404打不开,运行tomcat报错:
2011-11-7 11:24:48 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2011-11-7 11:24:48 org.apache.catalina.core.StandardContext start
严重: Context [/springStruts] startup failed due to previous errors
2011-11-7 11:24:49 org.apache.coyote.http11.Http11AprProtocol start

使用myeclipse5.5自动加入spring aop、core、web的jar包,然后拷贝strurs2包如图:

web.xml:
HTML code
<?xml version="1.0" encoding="UTF-8"?><web-app 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">  <welcome-file-list>    <welcome-file>index.jsp</welcome-file>  </welcome-file-list>  <context-param>      <param-name>contextConfigLocation</param-name>      <param-value>applicationContext.xml</param-value>  </context-param>  <listener>      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  </listener> </web-app>


struts.xml
HTML 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.objectFactory" value="spring" />    </struts>


applicationContext.xml是自动生成的,没改
HTML 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"    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"></beans>


------解决方案--------------------
tomcat启动错误,铁定打任何网页都是404,错误贴全了
------解决方案--------------------
web.xml:
没配置struts拦截啊
  相关解决方案