java - 带有 JDK 11 的 TOMCAT 7.0.92 :- ERROR localhost-startStop-1 org. apache.catalina.startup.ContextConfig - 无法处理 Jar tools.jar 的注释

标签 java tomcat tomcat7 java-11

我们有一个在 Tomcat 服务器容器上运行的 Web 应用程序。 Web 应用程序被编译并使用 JDK 11 作为运行时 JRE 以执行。

Tomcat Version : - 7.0.92 JDK Version :- 11

Problem Description :- 1.We are seeing the errors in tomcat log regarding jar scanning at time of Tomcat server startup. 2. Once Tomcat server is getting launched through our web application, it searches the Tools.jar for annotations purpose. 3. As we all know, JDK 11 has stopped shipping / bundling JRE which contains the tools.jar, Tomcat server reports an error which is following :--

ERROR localhost-startStop-1 org.apache.catalina.startup.ContextConfig - Unable to process Jar [jar:file:/ C:/JDK11/lib/tools.jar!/] for annotations
 java.nio.file.NoSuchFileException: C:\JDK11\lib\tools.jar
    at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
    at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
    at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
    at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53)
    at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
    at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:194)
    at java.base/java.nio.file.Files.readAttributes(Files.java:1763)
    at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1222)
    at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:824)
    at java.base/java.util.zip.ZipFile$CleanableResource$FinalizableResource.<init>(ZipFile.java:850)
    at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:839)
    at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:246)
    at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:176)
    at java.base/java.util.jar.JarFile.<init>(JarFile.java:346)
    at java.base/sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:103)
    at java.base/sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:72)
    at java.base/sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:109)
    at java.base/sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:125)
    at java.base/sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:92)
    at org.apache.tomcat.util.scan.FileUrlJar.<init>(FileUrlJar.java:48)
    at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:34)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1957)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1932)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1917)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1322)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5566)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1707)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1697)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

Resolution / workaround applied :- Post extensive search on Google and other community, We found that a property is suggested to be applied in the catalina.properties file which would help avoiding the scanning of all the jars. org.apache.catalina.startup.ContextConfig.jarsToSkip=*.jar We have this property already in place and even this has not helped resolving this issue.

因此,我们恳请您就此问题提供一些见解/可行的解决方案。如果需要更多信息,请回复。

感谢您的合作!

最佳答案

降级您的 JDK 到 JDK 8(tools.jar 已在 JDK 9 中删除),或者尝试升级您的 tomcat 版本到版本 8 或 9。

当有其他稳定版本时(tomcat 7 在 2011 年被宣布稳定!),我看不出有什么理由使用旧版本的 tomcat。避免混合使用新旧技术,因为它们彼此渐行渐远,就像您的情况一样。

旧版本的 tomcat 与新版本的 java 不兼容。

长话短说,试试 tomcat 8 或 9。

关于java - 带有 JDK 11 的 TOMCAT 7.0.92 :- ERROR localhost-startStop-1 org. apache.catalina.startup.ContextConfig - 无法处理 Jar tools.jar 的注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54107800/

相关文章:

java - Google 应用程序引擎或使用 Objectify 查询 id

java - 无法将我的项目部署到我之前部署在 glassfish 上的 tomcat 上

java - 使用Tomcat服务器缓存数据

java - 从 Tomcat servlet 运行 sudo 命令

java - 调用存储在 ArrayList 中的对象的方法时出错

java - 运行 Android 应用程序时 Eclipse ADT 卡住

java - 当我实现 android.gms :play-services-ads:19. 3.0 时,为什么我的 android 应用程序崩溃

java - 如何在java中的spring可重新加载消息资源中使用远程位置属性文件

java - 如何通过上下文对象获取资源元素

tomcat 7 cors过滤器