struts tiles 1.3 on tomcat 9 jdk 1.8 [错误]找不到指定网址的操作配置

时间:2017-07-10 13:40:18

标签: java tomcat java-8 tiles struts-1

我有一个应用程序在带有1.6 JDK的JBoss 5.1服务器上运行struts和struts-tiles 1.3而没有问题。 一旦我迁移到具有1.8 JDK的Tomcat 9服务器,我开始得到错误:

GRAVE: "Servlet.service()" pour la servlet [action] a lancé une exception
org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
    at org.apache.struts.chain.commands.AbstractSelectAction.execute(AbstractSelectAction.java:71)
    at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
    at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
    at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:710)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)
    at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:895)
    at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:497)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:129)
    at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:152)
    at org.apache.struts.tiles.taglib.InsertTag.doInclude(InsertTag.java:764)
    at org.apache.struts.tiles.taglib.InsertTag$InsertHandler.doEndTag(InsertTag.java:896)
    at org.apache.struts.tiles.taglib.InsertTag.doEndTag(InsertTag.java:465)
    at org.apache.jsp.WEB_002dINF.pages.layout.layout_jsp._jspx_meth_tiles_005finsert_005f0(layout_jsp.java:2297)
    at org.apache.jsp.WEB_002dINF.pages.layout.layout_jsp._jspService(layout_jsp.java:647)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
....

任何人都可以帮助我吗?

访问应用程序网址时出错:http://localhost:8080/myapp/authentification.do

特别是当服务器在layout.jsp标记处呈现tiles:insert时:

<tiles:insert attribute="corner" />

使用切片模板layout.jsp呈现页面 来自layout.jsp的片段:

<body>
        <div id="loading"></div>
        <c:set var="selectedTab" scope="request"><tiles:getAsString name="selectedTab"/></c:set>

        <c:if test="${sessionScope.utilisateur !=null}">
            <div id="bulle"><img src="${imgBulle}" border="0" /></div>
        </c:if>
                    <div id="corner"><tiles:insert attribute="corner" /></div>  

        <div id="container">
            <div id="top">
                <div id="title">                        
                    <h1><%@ include file="/WEB-INF/pages/include/title.jsp"%></h1>      
                    <div id="logo"><img src="${imgLogo}" border="0" /></div>



                </div>
            </div>
来自tiles.xml的相关配置:

    <definition name="page_corner" page="/WEB-INF/pages/layout/corner.jsp" />
<definition name="template" path="/WEB-INF/pages/layout/layout.jsp">
        <put name="title" value="" />
        <put name="corner" value="page_corner" />
        <put name="messages" value="Messages" />
        <put name="informations" value="Informations" />
        <put name="content" value="" />
        <put name="tabs" value="" />
        <put name="selectedTab" value="" />
    </definition>

1 个答案:

答案 0 :(得分:0)

我设法解决了我的问题,现在应用程序正在运行 问题是由于JSP 2.3引擎,因此当tiles:insert调用用空值定义的属性时会触发错误。

对我有用的解决方案是创建一个空的jsp文件empty.jsp,在tile中定义它并在我需要的地方使用它。

解决方案:

<definition name="page_empty" page="/WEB-INF/pages/layout/empty.jsp" />

以及(在问题中)模板配置将是:

<definition name="template" path="/WEB-INF/pages/layout/layout.jsp">
    <put name="title" value="" />
    <put name="corner" value="page_corner" />
    <put name="messages" value="Messages" />
    <put name="informations" value="Informations" />
    <put name="content" value="page_empty" />
    <put name="tabs" value="page_empty" />
    <put name="selectedTab" value="page_empty" />
</definition>

PS:<put name="corner" value="page_corner" />中定义的template不是问题的根源,而是<put name="corner" value="" />中定义的tiles_login扩展template的其他<definition name="tiles_login" extends="template"> <put name="title" value="application.authentification.title" /> <put name="corner" value="" /> <put name="bandeau" value="" /> <put name="content" value="" /> </definition>

controller.service_arguments