1

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.

Tom Anderson
  • 46,189
  • 17
  • 92
  • 133
Ziul
  • 883
  • 1
  • 13
  • 24
  • I've added a jboss-4.2.x tag to make the version clearer. You may well be using 4.3.0. I'm not sure why we don't have a generic 4.x tag. 4.2 was pretty different to 4.0, but still. – Tom Anderson Nov 14 '12 at 12:45

1 Answers1

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.

Toni
  • 1,381
  • 10
  • 16
  • I was trying hot deployment on the test server, it takes pretty long to restart JBoss just for a single change on a class or servlet, so i thought this could save a lot of time, I'm gonna try your suggestion and see what happens. – Ziul Nov 14 '12 at 17:04
  • OK, i got it working, but the directory is different on my JBoss: $JBOSSHOME/server/default/deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml, thanks for helping me out. – Ziul Nov 15 '12 at 17:51
  • Yes, the directory may change between JBoss versions, you've to look for the web/tomcat service. Remember that it's better not to use it in production environments! – Toni Nov 15 '12 at 18:23