java 无法在 web.xml 或使用此应用程序部署的 jar 文件中解析绝对 uri

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27236495/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 11:27:23  来源:igfitidea点击:

The absolute uri cannot be resolved in either web.xml or the jar files deployed with this application

javajspjboss5.xspring-socialtomee

提问by Seckin Tozlu

I'm converting a web application to use TomEE instead of Jboss 5.1.0 and seeing the following exception:

我正在将 Web 应用程序转换为使用 TomEE 而不是 Jboss 5.1.0 并看到以下异常:

ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[mlui]- Servlet.service()     for servlet [mlui] in context with path [] threw exception [The absolute uri: http://www.springframework.org/spring-social/social/tags cannot be resolved in either web.xml or the jar files deployed with this application] with root cause
org.apache.jasper.JasperException: The absolute uri: http://www.springframework.org/spring-social/social/tags cannot be resolved in either web.xml or the jar files deployed with this application
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:311)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:152)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1427)
at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)

I read all the similar questions and they all suffer from missing dependencies or not matching URIs between jsp and tld file. But in my case these are all fine. Here is my taglib declaration:

我阅读了所有类似的问题,但它们都存在缺少依赖项或 jsp 和 tld 文件之间的 URI 不匹配的问题。但就我而言,这些都很好。这是我的 taglib 声明:

<%@ taglib prefix="social" uri="http://www.springframework.org/spring-social/social/tags" %>

I have the spring-social.tld file in spring-social-web:1.1.0.RELEASE which is under WEB-INF\lib and it has the same URI as my jsp file. Here are the spring related libraries under WEB-INF\lib in case it can help.

我在 spring-social-web:1.1.0.RELEASE 中有 spring-social.tld 文件,它位于 WEB-INF\lib 下,它与我的 jsp 文件具有相同的 URI。下面是WEB-INF\lib 下的spring 相关库,以备不时之需。

spring-aop-3.2.2.RELEASE.jar
spring-beans-3.2.2.RELEASE.jar
spring-context-3.2.2.RELEASE.jar
spring-core-3.2.2.RELEASE.jar
spring-data-commons-core-1.4.0.RELEASE.jar
spring-expression-3.2.2.RELEASE.jar
spring-jdbc-3.2.2.RELEASE.jar
spring-security-config-3.1.3.RELEASE.jar
spring-security-core-3.1.3.RELEASE.jar
spring-security-crypto-3.1.3.RELEASE.jar
spring-social-config-1.1.0.RELEASE.jar
spring-social-core-1.1.0.RELEASE.jar
spring-social-facebook-1.1.1.RELEASE.jar
spring-social-instagram-1.0.1.BUILD.jar
spring-social-web-1.1.0.RELEASE.jar
spring-test-3.1.3.RELEASE.jar
spring-tx-3.2.2.RELEASE.jar
spring-web-3.2.2.RELEASE.jar
spring-webmvc-3.2.2.RELEASE.jar

回答by Seckin Tozlu

For those who are interested, I simply extracted the .tld file from the jar and put it under my WEB-INF directory and it solved the problem. I still don't know why TomEE was unable to resolve it when it was inside the jar.

对于那些有兴趣的人,我只是从 jar 中提取了 .tld 文件并将其放在我的 WEB-INF 目录下,它解决了问题。我仍然不知道为什么TomEE在罐子里时无法解决它。