开发者

"Path login.page does not start with a "/" character" message exception after changing java version

I have a web application which worked with the following: Tomcat 5.0 Struts 1.0 Java 1.5

I have to switch to Java 1.6.When I tried to do that, i received the following stack of exception in my browser:

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)

root cause

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开发者_如何学JAVA)
    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)


It looks like a request is made to "login.page", which as the exception indicates, does not start with a "/". Try requesting for "/login.page" instead.

Most servlet libraries require that pathnames begins with a "/". For example: javax.servlet.ServletContext#getRequestDispatcher:

The pathname must begin with a "/" and is interpreted as relative to the current context root. Use getContext to obtain a RequestDispatcher for resources in foreign contexts.


Check this page.

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

Obviously you're using stuts tiles. If you're using Struts 1.3, you should add this to your web.xml file:

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


Solved

Whenever new Jsp file is added new entry goes in respective

"struts-config_* .xml" and "tiles-defs_* .xml" files.


add the tile request processor class and remove the conten type attribute from controller tag

<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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜