Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Tiles 3 and Tomcat 8

I got the following error, when i use Tomcat 8:

Caused by: java.io.IOException: ServletException including path '/WEB-INF/jsp/tiles-base.jsp'.
at org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:61)
at org.apache.tiles.request.servlet.ServletRequest.doInclude(ServletRequest.java:245)
at org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:54)
at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
... 37 more
Caused by: java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.jsp.tiles_002dbase_jsp
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:131)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:62)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:129)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:171)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:368)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:523)
at org.apache.tiles.request.servlet.ServletRequest.doInclude(ServletRequest.java:243)
... 41 more

With the hope of getting rid of this error i upgraded to Tiles 3.0.5 from Tiles 2.2.2. But still get the same error with Tomcat 8.

With Tomcat 7 it works.

I use Spring version 3.2.9.RELEASE.

I think it must be something with the Servlet API...? Any idea what to do?

Here is the tiles-base.jsp:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<% response.setCharacterEncoding("ISO-8859-1"); %>
<jsp:directive.page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"/>
<jsp:directive.page isELIgnored="false" />
<jsp:directive.include file="/WEB-INF/jsp/taglibs.jsp" />
<c:set var="contextPath" value="${pageContext.servletContext.contextPath}" scope="request"/>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title><spring:message code="xxx"/></title>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
        <meta http-equiv="Content-Style-Type" content="text/css" />
        <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /> 
        <tiles:insertAttribute name="head-position" ignore="true" />
    </head>
    <body> 
        <div id="HEADER">
          <tiles:insertAttribute name="toolbar-position" ignore="true" />
        </div>
        <div class="APPWINDOW">
            <div class="TITLE">
                <c:choose>
                    <c:when test="${not empty titleFromFlow}">
                        <c:choose>
                            <c:when test="${not empty titleFromFlowArguments}">
                                <spring:message code="${titleFromFlow}" arguments="${titleFromFlowArguments}"/>
                            </c:when>
                            <c:otherwise>
                                <spring:message code="${titleFromFlow}"/>
                            </c:otherwise>
                        </c:choose>
                    </c:when>
                    <c:otherwise>
                        <tiles:importAttribute name="title" toName="titlecode" scope="page"/>
                        <c:if test="${not empty titlecode}">
                          <spring:message code="${titlecode}"/>
                        </c:if>
                    </c:otherwise>
                </c:choose>
            </div>

            <tiles:importAttribute name="_errorBegriffCode" toName="_errorBegriffCode" scope="request" ignore="true" />
            <tiles:importAttribute name="_errorMeldungCode" toName="_errorMeldungCode" scope="request" ignore="true" />
            <tiles:importAttribute name="_errorHtmlEscape" toName="_errorHtmlEscape" scope="request" ignore="true" />
            <tiles:importAttribute name="_errorBackForward" toName="_errorBackForward" scope="request" ignore="true" />

            <tiles:insertAttribute name="body-position" ignore="true" />
        </div>
        <tiles:insertAttribute name="foot-position" ignore="true" />
        <jsp:directive.include file="/WEB-INF/jsp/common/gitter.jsp" /> 
    </body>
</html>

And the relevant part of the Gradle build file:

apply plugin: 'cargo'

configurations {
    unzipTomcat
}

def cargoHome = "$buildDir/install/tomcat-home"

cargo {
    containerId = 'tomcat7x'
    port = 27386

    local {
        homeDir = file("$buildDir/install/apache-tomcat-8.0.20")
        configHomeDir = file(cargoHome)
        jvmArgs = "-Duser.language=en"
        outputFile = file('build/tomcat_output.log')
        logLevel = 'low'
        rmiPort = 28511
        timeout = 60000
        containerProperties {
            property 'cargo.tomcat.ajp.port', 28411
        }
    }

    deployable {
        file = files(project(':myapp:myapp-web').war).iterator().next()
        context = '/myapp'
    }
}

task configureUnzipTomcat << {
    unzipTomcat.inputs.file(configurations.unzipTomcat.singleFile)
    unzipTomcat.outputs.dir("$buildDir/install/apache-tomcat-8.0.20")
}
task unzipTomcat(dependsOn: configureUnzipTomcat) << {
    copy {
        from zipTree(configurations.unzipTomcat.singleFile)
        into "$buildDir/install"
    }
}

dependencies {
    unzipTomcat "org.apache.tomcat:tomcat:8.0.20@zip"
    cargo ["org.codehaus.cargo:cargo-core-uberjar:1.4.0", "org.codehaus.cargo:cargo-ant:1.4.0"]
}
like image 453
Cengiz Avatar asked Apr 22 '15 13:04

Cengiz


1 Answers

I had the same Issue. I upgraded tomcat to apache-tomcat-8.0.23 and It worked for me.

like image 159
Vaibhav Avatar answered Sep 17 '22 19:09

Vaibhav