I have a Java web application built with Spring MVC, JSPs, and Apache Tiles.

The same WAR file works fine on Windows 10 and Mac.

But on Ubuntu (18.04 on Amazon AWS) I get an error:

org.apache.jasper.JasperException: The absolute uri: [http://tiles.apache.org/tags-tiles] cannot be resolved in either web.xml or the jar files deployed with this application

My pom.xml file has these tiles-related dependencies ...

<dependency>
    <groupId>org.apache.tiles</groupId>
    <artifactId>tiles-jsp</artifactId>
    <version>3.0.7</version>
</dependency>

<dependency>
    <groupId>org.apache.tiles</groupId>
    <artifactId>tiles-autotag</artifactId>
    <version>1.2</version>
    <type>pom</type>
</dependency>

And the resulting WAR file has the following JAR files in the WEB-INF/lib folder ...

tiles-api-3.0.7.jar
tiles-autotag-core-runtime-1.2.jar
tiles-core-3.0.7.jar
tiles-jsp-3.0.7.jar
tiles-request-api-1.0.6.jar
tiles-request-jsp-1.0.6.jar
tiles-request-servlet-1.0.6.jar
tiles-servlet-3.0.7.jar
tiles-template-3.0.7.jar

Also note, the tomcat /examples application seems to work fine. I'm pretty new to linux ... could this be an Ubuntu-related file permissions thing?

More stack trace details, in case it's useful ...

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/jsp/f_layout.jsp'.
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:986)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:870)

[...]

org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/jsp/f_layout.jsp'.
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:399)
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)
    org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)

[...]

org.apache.jasper.JasperException: The absolute uri: [http://tiles.apache.org/tags-tiles] cannot be resolved in either web.xml or the jar files deployed with this application
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:293)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:80)
    org.apache.jasper.compiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:251)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:122)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:431)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:489)
2

There are 2 best solutions below

0
AvaTaylor On BEST ANSWER

The problem turned out to be that for some reason Tomcat was no longer looking for the Tiles library's TLD file inside the Tiles JAR file. There's a way to turn off TLD scanner (<Context processTlds="false" ... />) but mine wasn't turned off.

I don't know what I did to cause this to start happening -- I made very little changes to the tomcat configuration.

A workaround to stop the problem was to manually copy the TLD file from inside the Tiles JAR file and copy it to the /WEB-INF folder. That made the problem stop, but then I'd have to do this for many other JAR files in my project. (For Example: After doing it for Tiles, I got the same error for SpringSecurity).

In the end, I created a new Ubuntu 18.04 instance and installed fresh copies of Java and Tomcat, and everything worked.

UPDATE:

After fiddling with config files, it's likely the problem I had was caused by this line in /var/lib/tomcat8/conf/catalina.properties ...

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\
*.jar,\
[...]

... which caused all JAR files to get skipped during scanning.

0
DivDiff On

The same thing worked for me. I'm doing a tutorial using spring boot and apache tiles-jsp version 3.0.8. I extracted the contents of this jar using the following:

jar xf tiles-jsp-3.0.8.jar

This wrote the contents of the jar into my directory. I found the tld files in the META-INF directory. I copied them to my WEB-INF directory, redeployed, and the error went away.