tomcat/lib的罐子在运行时未识别

发布于 2025-01-29 01:10:48 字数 1121 浏览 3 评论 0原文

为了准备更新我的JDK,我想删除servlet-apijsp-apiel-api jars中的jars > java_home/jre/lib/ext 目录,而是将它们添加到classPath,如推荐

我试图通过提供提供的范围添加这些依赖项来做到这一点。

但是,当我(本地)部署Web应用程序时,我仍然会得到一个classNotFoundException,我认为这是由3个缺少的JARS引起的(当我将它们包含在旧的JDK位置中时,此例外消失了) 。

java.lang.classnotfoundexception: javax.servlet.jsp.tagext.bodytagsupport

i double检查以确保为项目定义了J2EE ClassPath。从我的理解来看,该应用程序应在运行时从我的服务器容器(Tomcat)中访问3罐。实际上,看来此类路径的定义很好:

j2ee.platform.classpath
j2ee.server.home

在我的项目属性文件中都定义了。

另外,据我所知,我并不是在Web-Inf/lib中加入这些罐子中的任何一个,所以我认为这也不是引起问题的原因。我确实将罐子定义为依赖项,但我给他们提供提供的范围,每个jar的版本如下所示: https://tomcat.apache.org/whichversion.html (用于TOMCAT版本8.0.43)。

我正在NetBeans上使用ANT构建应用程序。

还有关于为什么在运行时未识别这些JAR文件的其他建议?

In preparation for updating my JDK, I would like to remove the servlet-api, jsp-api and el-api jars from the JAVA_HOME/jre/lib/ext directory and instead add them to the classpath as is recommended.

I attempt to do this by adding these dependencies with the provided scope.

However, when I deploy my web application (locally), I still get a ClassNotFoundException, which I think is caused by the 3 missing jars (when I include them in the old jdk location, this exception disappears).

java.lang.ClassNotFoundException:
javax.servlet.jsp.tagext.BodyTagSupport

I double checked to make sure that the j2ee classpath is well defined for the project. From my understanding, the application should have access to the 3 jars from my server container (Tomcat) at runtime. Indeed, it seems that this classpath was well defined:

j2ee.platform.classpath
j2ee.server.home

are both defined in my project properties file.

Also, as far as I know I'm not including any of these jars in WEB-INF/lib so I don't think that's what's causing the issue either. I do define the jars as dependencies but I give them the provided scope, with versions for each jar as dictated by this chart: https://tomcat.apache.org/whichversion.html (for Tomcat version 8.0.43).

I'm building the application with ant on Netbeans.

Are there any other suggestions for why these jar files are not recognized at runtime?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

相守太难 2025-02-05 01:10:48

当我启动该项目时,我笨拙地将一些依赖罐放在java-home/jre/lib/ext中。

去除这些罐子解决了问题。他们的依赖项与他们捆绑在一起,其中包括jsp-api.jarservlet-api.jar

When I had started the project, I clumsily placed some dependency jars in JAVA-HOME/jre/lib/ext.

Removing these jars solved the issue. They had dependencies bundled with them that included jsp-api.jar or servlet-api.jar.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文