opengrok
opengrok copied to clipboard
Failed to scan [file:/var/tomcat8/webapps/source/WEB-INF/lib/annotations-19.0.0.jar]
After #3387 there is one remaining jar that needs to be addressed:
02-Dec-2020 23:23:35.081 WARNING [localhost-startStop-1] org.apache.tomcat.util.scan.StandardJarScanner.processURLs Failed to scan [file:/var/tomcat8/webapps/source/WEB-INF/lib/annotations-19.0.0.jar] from classloader hierarchy
java.io.IOException: java.lang.reflect.InvocationTargetException
at org.apache.tomcat.util.compat.Jre9Compat.jarFileNewInstance(Jre9Compat.java:205)
at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:65)
at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:49)
at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:385)
at org.apache.tomcat.util.scan.StandardJarScanner.processURLs(StandardJarScanner.java:320)
at org.apache.tomcat.util.scan.StandardJarScanner.doScanClassPath(StandardJarScanner.java:283)
at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:234)
at org.apache.catalina.startup.ContextConfig.processJarsForWebFragments(ContextConfig.java:1916)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1130)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:779)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1125)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1858)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
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)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.apache.tomcat.util.compat.Jre9Compat.jarFileNewInstance(Jre9Compat.java:202)
... 23 more
Caused by: java.nio.file.NoSuchFileException: /var/tomcat8/webapps/source/WEB-INF/lib/annotations-19.0.0.jar
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:149)
at java.base/java.nio.file.Files.readAttributes(Files.java:1763)
at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1225)
at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:727)
at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:844)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:247)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)
at java.base/java.util.jar.JarFile.<init>(JarFile.java:348)
... 27 more
Interestingly opengrok-indexer.pom has the annotations artifact at 20.1.0 and the web app has also another version:
# find /var/tomcat8/webapps/source/ -name 'annotations*.jar' -type f
/var/tomcat8/webapps/source/WEB-INF/lib/annotations-12.0.jar
/var/tomcat8/webapps/source/WEB-INF/lib/annotations-20.1.0.jar
Looks like one of the .jar files has a dependency on 19.0.0 however it is not opengrok.jar.
I went through all the META-INF/MANIFEST.MF files for all the .jar files shipped with OpenGrok in the dist directory and there is no mention of annotations-19.0.0.
I can see this only when Tomcat is restarted. For the record, the only other applications are the manager and host-manager.
Going through https://mvnrepository.com/artifact/org.jetbrains/annotations/19.0.0/usages?p=1 I noticed chronicle-map related artifacts. Namely chronicle-bytes-2.20.80.jar depends on annotations-19.0.0.jar. Even the latest version of chronicle-bytes-2.20.105 depends on annotations-19.0.0.jar so upgrade will not fix that.
can we add dependency to opengrok-indexer pom.xml and opengrok-web pom.xml ??? both of them version fix to 19.0.0
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>19.0.0</version>
</dependency>
No, we cannot. 19.0.0 is old and that would be also wrong as annotations is only compile time dependency so there is no need to actually include it in the release jar. For now the best "fix" is to disable jar scanning on the tomcat level until chronicle will fix their libraries.
Created an issue for jetbrains annotations dependency in chronicle-map (https://github.com/OpenHFT/Chronicle-Map/issues/289)
I think there is still a couple of other errors with the same cause (if I recall correctly, it was javax.el from cron-utils).