I have a webapp in a war archive which is deployed on cloudfoundry.
One of the libraries ("`somelib.jar`") used by the app is made by another developer.
I would like a way for him to upload several different versions of `somelib.jar` and test the behaviour of the app.
I have managed to get the jar uploaded to `WEB-INF/lib` directory of the deployment. I have also managed to unpack the jar into `WEB-INF/classes`. However, I have not managed to get the new version of the jar to be used. I tried various hacks such as those described in [this question] and [this question] without any luck.
Everytime, the classes/jars that get loaded the first time get used 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 dont have control of Tomcat (where it runs), I cannot configure Tomcat or make any changes to the server. I just have control on my war file, *so everything needs to be done programmatically*.
EDIT: the reason I want this is to reduce our testing time. Currently someone gives me a new version of `somelib.jar`, I repackage it into my application, upload to CF, send him a notification, then he tests the behavior of the new jar. What I would have preferred is that he upload his jar directly to CF and do the testing whenever he has a new version without the unnecessary intermediate delay.
: https://stackoverflow.com/questions/3621505/swapping-a-running-jar-at-runtime you can drop a completely new war file, because the webapp directory is usually doing hot deploy unless that configuration is turned off in tomcat. That only allows you to have one version running at once but it does 'hot deploy' without a restart. There are problems with this and nobody would seriously consider doing this in a production environment.
以上就是How to dynamically update (hot swap) jars in a web-app?的详细内容，更多请关注web前端其它相关文章！