简体   繁体   English

为什么会出现错误“绝对 uri:[http://tiles.apache.org/tags-tiles] 无法在 web.xml 或部署的 jar 文件中解析”

[英]Why getting error “The absolute uri: [http://tiles.apache.org/tags-tiles] cannot be resolved in either web.xml or the jar files deployed”

I have a Java web application built with Spring MVC, JSPs, and Apache Tiles.我有一个用 Spring MVC、JSP 和 Apache Tiles 构建的 Java Web 应用程序。

The same WAR file works fine on Windows 10 and Mac.相同的 WAR 文件在 Windows 10 和 Mac 上运行良好。

But on Ubuntu (18.04 on Amazon AWS) I get an error:但是在 Ubuntu(亚马逊 AWS 上的 18.04)上,我收到一个错误:

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 ...我的 pom.xml 文件有这些与磁贴相关的依赖项......

<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 ...生成的 WAR 文件在 WEB-INF/lib 文件夹中有以下 JAR 文件...

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.另请注意,tomcat /examples应用程序似乎工作正常。 I'm pretty new to linux ... could this be an Ubuntu-related file permissions thing?我对 linux 很陌生……这可能是与 Ubuntu 相关的文件权限问题吗?

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)

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.问题原来是由于某种原因,Tomcat 不再在 Tiles JAR 文件中查找 Tiles 库的 TLD 文件。 There's a way to turn off TLD scanner ( <Context processTlds="false" ... /> ) but mine wasn't turned off.有一种方法可以关闭 TLD 扫描器( <Context processTlds="false" ... /> ),但我的没有关闭。

I don't know what I did to cause this to start happening -- I made very little changes to the tomcat configuration.我不知道我做了什么导致这种情况开始发生——我对 tomcat 配置做了很少的更改。

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.解决此问题的方法是从 Tiles JAR 文件中手动复制 TLD 文件并将其复制到 /WEB-INF 文件夹。 That made the problem stop, but then I'd have to do this for many other JAR files in my project.这使问题停止,但随后我必须为我的项目中的许多其他 JAR 文件执行此操作。 (For Example: After doing it for Tiles, I got the same error for SpringSecurity). (例如:在为 Tiles 执行此操作后,我在 SpringSecurity 中遇到了相同的错误)。

In the end, I created a new Ubuntu 18.04 instance and installed fresh copies of Java and Tomcat, and everything worked.最后,我创建了一个新的 Ubuntu 18.04 实例并安装了 Java 和 Tomcat 的新副本,一切正常。

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 ...在摆弄配置文件后,我遇到的问题很可能是由/var/lib/tomcat8/conf/catalina.properties的这一行引起的...

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

... which caused all JAR files to get skipped during scanning. ...这导致所有 JAR 文件在扫描过程中被跳过。

The same thing worked for me.同样的事情对我有用。 I'm doing a tutorial using spring boot and apache tiles-jsp version 3.0.8.我正在做一个使用 spring boot 和 apache tile-jsp 3.0.8 版的教程。 I extracted the contents of this jar using the following:我使用以下方法提取了这个 jar 的内容:

jar xf tiles-jsp-3.0.8.jar

This wrote the contents of the jar into my directory.这将 jar 的内容写入我的目录。 I found the tld files in the META-INF directory.我在 META-INF 目录中找到了 tld 文件。 I copied them to my WEB-INF directory, redeployed, and the error went away.我将它们复制到我的 WEB-INF 目录,重新部署,错误消失了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用taglib uri =“ http://tiles.apache.org/tags-tiles”时出错 - Getting error with taglib uri=“http://tiles.apache.org/tags-tiles” 无法在web.xml或jar文件中解析Struts标签-tiles - Struts tags-tiles cannot be resolved in either web.xml or the jar files 绝对uri:http://www.springframework.org/tags不能在web.xml或与此应用程序一起部署的jar文件中解析 - The absolute uri: http://www.springframework.org/tags cannot be resolved in either web.xml or the jar files deployed with this application 绝对的uri:http://www.springsource.org/tags/form无法在web.xml或使用此应用程序部署的jar文件中解析 - The absolute uri: http://www.springsource.org/tags/form cannot be resolved in either web.xml or the jar files deployed with this application JspTaglib [“http://tiles.apache.org/tags-tiles”] 未定义:它不能分配给磁贴 - JspTaglib [“http://tiles.apache.org/tags-tiles”] is undefined: It cannot be assigned to tiles Struts 绝对 uri:http://struts.apache.org/tags-bean 无法在 web.xml 或与此应用程序一起部署的 jar 文件中解析 - Struts The absolute uri: http://struts.apache.org/tags-bean cannot be resolved in either web.xml or the jar files deployed with this application 绝对的uri:http://java.sun.com/jsp/jstl/core无法在web.xml或使用此应用程序部署的jar文件中解析 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this app 如何解决&#39;绝对uri:http://java.sun.com/portlet无法在web.xml或使用此应用程序部署的jar文件中解析&#39; - How to fix 'The absolute uri: http://java.sun.com/portlet cannot be resolved in either web.xml or the jar files deployed with this application' 无法在web.xml或使用此应用程序部署的jar文件中解析绝对uri - The absolute uri cannot be resolved in either web.xml or the jar files deployed with this application 绝对uri:http://java.sun.com/jsp/jstl/core不能在web.xml或tomcat中与此应用程序错误一起部署的jar文件中解决 - Absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application error in tomcat
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM