How to dynamically update (hot swap) banks in a web application?

I have a webapp in a military archive that deploys to cloudfoundry. One of the libraries (" somelib.jar ") used by the application is created by another developer.

I would like it to download several different versions of somelib.jar and test the behavior of the application. I managed to load the jar into the deployment WEB-INF/lib directory. I also managed to unpack the jar on WEB-INF/classes . However, I was not able to get a new version of the can for use. I tried various hacks, such as those described in this question and this question with no luck.

Each time, classes / banks that are loaded for the first time become available after that, even if we replace the actual .class or .jar file in the above directories.

Is there any easy way to achieve what I want?

Note. Since I do not have control over Tomcat (where it runs), I cannot configure Tomcat or make any changes to the server. I just control my war file, so everything needs to be done programmatically.

EDIT: the reason I want to shorten the testing time. Currently, someone gives me a new version of somelib.jar , I repackage it in my application, upload it to CF, send him a notification, and then test the behavior of the new jar. I would prefer that he upload his jar directly to CF and perform testing when he had a new version without unnecessary intermediate delay.

+4
source share
3 answers

In tomcat 7, you can update your WAR file and new versions will be gradually downloaded.

http://www.tomcatexpert.com/blog/2011/05/31/parallel-deployment-tomcat-7

+2
source

Each time, classes / jars that are loaded for the first time will be used after that, even if we replace the actual .class or .jar file in the directories above

That the regular Tomcat (Java EE) classloading program works . Your classes are loaded during the first deployment, and any changes will be ignored (JSPs are managed a little differently, but only in the development environment).

You must solve this problem using the Equinox servlet of the OSGi bridge . I myself did not do this, but here I wrote a man whom I respect.

+2
source

To manage the application server yourself, you will need to deploy a stand-alone application in Cloud Foundry.

This blog should help you with this:

http://blog.cloudfoundry.com/2012/05/11/running-standalone-web-applications-on-cloud-foundry/

This way you can customize your tomcat.

+2
source

All Articles