user3820339
user3820339

Reputation: 151

TOMCAT 7.0.92 with JDK 11 :- ERROR localhost-startStop-1 org.apache.catalina.startup.ContextConfig - Unable to process Jar tools.jar for annotations

We have a web application running on Tomcat server container. Web application is compiled and using JDK 11 as runtime JRE for execution purpose.

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.

Therefore, we request you to kindly provide some insight / working resolution of this issue. Please revert in case any more info is required.

Appreciate your co-operation !

Upvotes: 0

Views: 4104

Answers (1)

Daniel B.
Daniel B.

Reputation: 2601

Either downgrade your JDK to JDK 8 (tools.jar was removed in JDK 9), or try upgrading your tomcat version to version 8 or 9.

I dont see a reason for using an old version of tomcat when there are other stable releases (tomcat 7 was declared stable in 2011!). Avoid mixing old and new technologies, as they drift apart from each other, like in your case.

An old version of tomcat will not be compatible with a new version of java.

Long story short, try out tomcat 8 or 9.

Upvotes: 4

Related Questions