- Java code
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.or[code=Java]
<struts>
<!-- <constant name="struts.objectFactory" value="spring"/>-->
<include file="struts-default.xml"/>
<constant name="struts.custom.i18n.resources" value="globalMsges"></constant>
<package name="person" extends="struts-default">
<action name="login" class="loginAction">
<result>/index.jsp</result>
<result name="input">/pages/login.jsp</result>
</action>
</package>
</struts>
[/code]
这里是struts.xml的配置,我排错就到这里出了问题,在login中的 class 在spring配置文件中(如下)
- Java 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"><bean id="loginService" class="com.test.service.impl.LoginServiceImpl"></bean><bean id="loginAction" class="com.person.action.LoginAction" scope="prototype"> <property name="loginService"> <ref local="loginService"/> </property></bean></beans>
就会报错:
严重: Error filterStart
2009-4-30 13:57:31 org.apache.catalina.core.StandardContext start
严重: Context [/person] startup failed due to previous errors
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
2009-4-30 13:57:31 org.apache.coyote.http11.Http11BaseProtocol start
------解决方案--------------------
Error filterStart 看到这个 应该是 Spring 过滤器的问题
在web.xml设置一下使用Spring的过滤器给所有的地址进行转码就可以了:
<filter>
<filter-name>Spring character encoding filter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Spring character encoding filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
------解决方案--------------------
<constant name="struts.objectFactory" value="spring"/>
上面那个为什么注释呢
------解决方案--------------------
帮顶下
------解决方案--------------------
可能是web.xml中的配置有问题,建议部署到其它的server上试试,如weblogic、jes等,可能会有更详细的错误信息。
------解决方案--------------------
回帖是一种美德!每天回帖即可获得 10 分可用分
------解决方案--------------------
你用tomcat 的吗 版本是不是低了