Hello,

Recently I ran into a very strange issue while deploying the web applications.

The trigger to this issue was adding one more web application (war) under the 
given app base. To be precise, moving this application from one app base to 
another.

During startup:

java.lang.NoClassDefFoundError: myapp/mypackage/myclass1
at myapp.MyContextListener.contextInitialized(MyAppContextListener.java:27) at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4008)
 at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4436)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:599) 
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:571) at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:654) at 
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:969) at 
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1911) at

java.lang.NoClassDefFoundError: myapp/mypackage/myclass2
at myapp.MyContextListener.contextInitialized(MyAppContextListener.java:47) at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4008)
 at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4436)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:599) 
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:571) at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:654) at 
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:969) at 
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1911) at

java.lang.NoClassDefFoundError: myapp/mypackage1/myclass3
at myapp.MyContextListener.contextInitialized(MyAppContextListener.java:37) at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4008)
 at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4436)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:599) 
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:571) at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:654) at 
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:969) at 
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1911) at


These errors are coming from an app which was already part of the same app 
base, which hasn't been changed at all.

And this wasn't reproducible on all the systems consistently. One of my test 
setups has 24 cores and around 270GB ran, and this is issue is fairly 
consistent on such a configuration. Not sure what's special about it given that 
it works on a setup with more than 24 CPU cores.

Little bit of debugging around the "startStopThreads=" setting in server.xml. 
Both the "Engine" and "Host" has "startStopThreads=0" which means by default 
the number of utility threads will be equal to the number of processors.
For testing purposes, I changed this "startStopThreads=1" and all the 
applications were deployed as expected. For now, I have used this workaround.

So, it seems like related to parallel deployment of web applications.

Any input on how to debug this very strange further? FWIW, I am using Java 21 
and Tomcat 10.1.34. Also, does it matter that the applications being deployed 
might have same set of third-party libraries packaged the war files?

Thanks,
Amit







Reply via email to