Saturday, October 15, 2011

Application Context constantly being destroyed and reloaded

This post should help those who face the situation where their Application Context constantly being destroyed and then reloaded. The issue also might follow with these log messages:
- INFO: Additional JARs have been added : 'someJar.jar'
- org.apache.catalina.loader.WebappClassLoader modified

I know this issue has been address over the web, but if I would be able to save even one developer few hours then it is worth the time I spend writing it.

To make a long story short - this issue is caused due to a corrupted jar being deployed in your application.
The INFO message indicates which jar caused the problem exactly.

Please notice that sometimes, modifying the jar in the application might not be enough. One might need to seek and destroy the corrupted jar in the deployed application.

Some solutions on the web discussing seeking the jar in Maven (like here), but in my case it was a simple copy & paste into the project WEB-INF/lib folder.

If you use Eclipse (STS) and Tomcat and the server is configured to "use workspace metadata (do not modify Tomcat installation)"  , then going into the Tomcat webapp folder will not help
You can find the mentioned jar by right click on the Tomcat instance (in the Server tab) and choose open.
Then click on "open launch configuration". In the VM arguments inner window, you will find the full path in the variable:  -Dwtp.deploy .

1 comment :

  1. Thanks for you blog. We encountered similar issue but unfortunately - no name was given after the INFO message - Additional jars have been added. What could be the issue for this? Any pointer would help. We are using Tomcat 6.0.35 Thanks in advance

    ReplyDelete