How to dynamically update (hot swap) jars in a web-app?

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][1] and [this question][2] 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. [1]: https://stackoverflow.com/questions/60764/how-should-i-load-jars-dynamically-at-runtime [2]: 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前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏