InvocationTargetException after web app is deployed

Recently after updating to tomcat 9 and openjdk 16, we started to have an issue with redeployments not going well. We got a lot of InvocationTargetException’s in our logs once redeployment was started.

Problem turned out to be the name of our war file grim#dandel.war. So we fixed it be renaming the war file and putting the context information in conf/context.xml

29-Apr-2021 10:47:42.029 INFO [ajp-nio-127.0.0.1-8109-exec-29] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/tomcat/webapps/grim#dandel.war] has finished in [9,092] ms 29-Apr-2021 10:47:42.029 SEVERE [Catalina-utility-2] org.apache.catalina.core.ContainerBase.removeChild Error destroying child org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/grim/ dandel]] in state [STARTED] at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:430) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:316) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:817) at org.apache.catalina.startup.HostConfig.undeploy(HostConfig.java:1460) at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1369) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1647) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:315) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1151) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1353) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1335) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:831) 29-Apr-2021 10:47:42.058 INFO [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/opt/tomcat/webapps/grim#dandel.war] Exception in thread "Thread-3410" java.lang.IllegalStateException: java.io.IOException: java.lang.reflect.InvocationTargetException at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:101) at org.apache.catalina.webresources.AbstractArchiveResourceSet.getResource(AbstractArchiveResourceSet.java:263) at org.apache.catalina.webresources.StandardRoot.getResourceInternal(StandardRoot.java:281) at org.apache.catalina.webresources.Cache.getResource(Cache.java:62) at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:216) at org.apache.catalina.webresources.StandardRoot.getClassLoaderResource(StandardRoot.java:225) at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2316) at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:864) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1187) at org.springframework.util.ClassUtils.forName(ClassUtils.java:250) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.(AutowiredAnnotationBeanPostProcessor.java:154) at org.springframework.web.context.support.SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(SpringBeanAutowiringSupport.java:83) Exception in thread "Thread-3410" java.lang.IllegalStateException: java.io.IOException: java.lang.reflect.InvocationTargetException at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:101) at org.apache.catalina.webresources.AbstractArchiveResourceSet.getResource(AbstractArchiveResourceSet.java:263) at org.apache.catalina.webresources.StandardRoot.getResourceInternal(StandardRoot.java:281) at org.apache.catalina.webresources.Cache.getResource(Cache.java:62) at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:216) at org.apache.catalina.webresources.StandardRoot.getClassLoaderResource(StandardRoot.java:225) at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2316) at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:864) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1187) at org.springframework.util.ClassUtils.forName(ClassUtils.java:250) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.(AutowiredAnnotationBeanPostProcessor.java:154) at org.springframework.web.context.support.SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(SpringBeanAutowiringSupport.java:83) at java.base/java.lang.Thread.run(Thread.java:831) Caused by: java.io.IOException: java.lang.reflect.InvocationTargetException at org.apache.tomcat.util.compat.Jre9Compat.jarFileNewInstance(Jre9Compat.java:209) at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:226) at org.apache.catalina.webresources.AbstractArchiveResourceSet.openJarFile(AbstractArchiveResourceSet.java:314) at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:97) ... 15 more 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.newInstanceWithCaller(Constructor.java:499) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) at org.apache.tomcat.util.compat.Jre9Compat.jarFileNewInstance(Jre9Compat.java:206) ... 18 more Caused by: java.nio.file.NoSuchFileException: /opt/tomcat/webapps/grim#dandel.war/WEB-INF/lib/batik-script-1.13.jar at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) 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/sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99) at java.base/java.nio.file.Files.readAttributes(Files.java:1843) at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1212) at java.base/java.util.zip.ZipFile$CleanableResource.(ZipFile.java:706) at java.base/java.util.zip.ZipFile.(ZipFile.java:240) at java.base/java.util.zip.ZipFile.(ZipFile.java:171) at java.base/java.util.jar.JarFile.(JarFile.java:349) ... 23 more

 

Like this post? Don’t forget to share it!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.