Search code examples
javatomcatjava-8tilesstruts-1

struts tiles 1.3 on tomcat 9 jdk 1.8 [Error] No action config found for the specified url


I have an application running struts and struts-tiles 1.3 on a JBoss 5.1 Server with 1.6 JDK without problems. once I migrated to a Tomcat 9 server with 1.8 JDK I start getting an ERROR :

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)
....

Can any one help me please ?

The error occur when I access the application URL : http://localhost:8080/myapp/authentification.do

specifically when server renders layout.jsp at tiles:insert tag :

<tiles:insert attribute="corner" />

The page is rendered with a tiles template layout.jsp snippet from 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>

related configuration from 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>

Solution

  • I managed to solve my problem and the application is running now.
    The issue is due to JSP 2.3 engine hence when tiles:insert calls an attribute defined with an empty value it trigger the error.

    The solution that worked for me is to create an empty jsp file empty.jsp, define it in tiles and use it wherever I need.

    Solution:

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

    and the above (in the question) template configuration would be :

    <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" /> defined in template was not the source of the problem but an other <put name="corner" value="" /> defined in tiles_login that extends 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>