JBoss redeploy changes on exploded deployment directory

╄→гoц情女王★ 提交于 2019-12-08 07:00:54

问题


Searching for a way to deploy new changes without restarting the JBoss leaded me to this:

https://community.jboss.org/wiki/RedeployAnApplicationWhenChangeAFileInAnExplodedDeploymentDirectory

And at first, I thought I just found the holy grail, touching the top level descriptor on a exploded directory will redeploy the new changes, but then the weird behavior and errors started.

Turns out that servlets and Java classes are not getting redeployed, after reading many negative answers around, I gave up on this, but at least I want to know, whats getting redeployed after touching the top level descriptor?

If you guys need to know, I'm deploying a Java EE project as a war on JBoss 4x.


回答1:


Though the application is really redeployed the work directory isn't really deleted by default (it's where JBoss saves the compiled jsp's), so after a redeploy it may keep the previous compiled jsp classes.

In JBoss 5.1 (I'm not 100% sure if it's available in JBoss 4.x) there is an option to force JBoss deleting the work directory for an application when it's undeployed - redeployed. You can find this option in: $JBOSS_HOME/server/yourInstance/deployers/jbossweb.deployer/META-INF/war-deployers-jboss-beans.xml, in this file look for the property:

<property name="deleteWorkDirOnContextDestroy">true</property>

By default it's set to false, so set it true. Maybe it may help to solve your problem when redeploying, though the success of hotdeployment may depend on dependencies on other classes, etc. On the other hand when hot deploying or redeploying an application, use the move command (mv), but never the copy (cp) one, since the mv is atomic but not the cp (with cp the hot deployment scanner could be activated while the file is still being copied).

Another solution to hot redeploy is to delete it manually, (recommended just for development environments) we use the following chain of commands (taking in mind you're already in the deploy directory):

rm yourapp.war; rm -rf ../work/jboss.web/localhost/yourapp;mv <newappversiondir>/yourapp.war .

But take in mind that hot deployment in production and critical environments is strongly discouraged.



来源:https://stackoverflow.com/questions/13370879/jboss-redeploy-changes-on-exploded-deployment-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!