I created a gradle task that deploys an unpacked WAR package to a specific directory. Tomcat is configured to use exactly that directory as web application and deploy the package including reloadable="true"
.
As long as I run the task manually using ./gradlew explodedWar --parallel
every time something changes everything works fine. The directory is rebuilt (not cleaned but updated) and tomcat reloads the application a few seconds later.
Anyway as soon as I try to use continious build feature of Gradle using ./gradlew explodedWar -t --parallel
it doesn't really work anymore. Gradle rebuilds on every change automatically but Tomcat crashes very often leading the application to return nothing but 404
anymore.
Has anybody any idea why this might happen? There is no error in the Tomcat log. Furthermore I guess the -t
option should basically be the same as calling gradle manually after any change. But in the later case Tomcat does never crash.
Edit: After some further testing I got this error from Tomcat. This happens only about 1/20 times of the crashes so it might not be related but I guess Gradle rebuilds while Tomcat is loading the JAR files.
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: error in opening zip file
at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:96)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
... 14 more
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.jar.JarFile.<init>(JarFile.java:166)
at java.util.jar.JarFile.<init>(JarFile.java:103)
at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:88)
... 15 more