“更改java版本后,路径login.page不以”/“字符”消息异常开头

时间:2010-02-26 14:40:30

标签: java struts

我有一个使用以下内容的Web应用程序: Tomcat 5.0 Struts 1.0 Java 1.5

我必须切换到Java 1.6。当我尝试这样做时,我收到了以下堆栈 浏览器中的异常:

javax.servlet.ServletException: Path login.page does not start with a "/" character
    org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:72)
    org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:712)
    org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:682)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:45)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)

根本原因

java.lang.IllegalArgumentException: Path login.page does not start with a "/" character
    org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:107)
    org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
    org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
    org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
    org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
    org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:72)
    org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:712)
    org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:682)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:45)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)

4 个答案:

答案 0 :(得分:4)

看起来像"login.page"的请求,如异常所示,不以"/"开头。请尝试申请"/login.page"

大多数servlet库要求路径名以"/"开头。例如:javax.servlet.ServletContext#getRequestDispatcher

  

路径名必须以"/"开头,并且被解释为相对于当前上下文根。使用getContext为外国环境中的资源获取RequestDispatcher

答案 1 :(得分:2)

查看此页面。

http://wiki.apache.org/struts/StrutsUpgradeNotes12to13

显然你正在使用stuts tiles。如果您使用的是Struts 1.3,则应将其添加到您的web.xml文件中:

<init-param>
    <param-name>chainConfig</param-name>
    <param-value>org/apache/struts/tiles/chain-config.xml</param-value>
</init-param>

答案 2 :(得分:0)

添加切片请求处理器类并从控制器标记

中删除内容类型属性
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" />

<message-resources parameter="EMSMessageResources" null="false" ></message-resources>

<plug-in className="org.apache.struts.tiles.TilesPlugin" >
    <set-property property="definitions-config" value="/WEB-INF/ems-tiles-defs.xml" />
    <set-property property="moduleAware" value="true" />
</plug-in>

答案 3 :(得分:0)

已解决

无论何时添加新的Jsp文件,新条目都会进入相应的

struts-config_ * .xml ”和“ tiles-defs_ * .xml ”文件。