سؤال

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.

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top