views:

3507

answers:

2

I am developing a Java EE application that I deploy over and over again on a local JBoss installation during development. I want to speed up the build by hot deploying my application straight into [JBOSS]/server/default/deploy/myApp

It seems to work - but there also seems to be a somewhat arbitrary delay between the hard deploy and when JBoss starts using the new classes. I am not very familiar with JBoss, but I assume it caches classes, and that this is what causes the problem.

Am I correct, and if so, how do I make JBoss flush it's cache?

+3  A: 

Unfortunately, it's not that easy. There are more complicated things behind the scenes in JBoss (most of them ClassLoader related) that will prevent you from HOT-DEPLOYING your application.

For example, you are not going to be able to HOT-DEPLOY if some of your classes signatures change.

So far, using MyEclipse IDE (a paid distribution of Eclipse) is the only thing I found that does hot deploying quite successfully. Not 100% accuracy though. But certainly better than JBoss Tools, Netbeans or any other Eclipse based solution.

I've been looking for free tools to accomplish what you've just described by asking people in StackOverflow if you want to take a look.

Pablo Santa Cruz
Sorry, got the "hard deploy" from the maven goal for doing that. This confuses me though, as the documentation I find tells me it is just that easy (http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/Getting_Started/The_JBoss_Server___A_Quick_Tour-Hot-deployment_of_services_in_JBoss.html for example). I can see how it would be a problem with EJB-related stuff that might have more intricate connections though..
Jacob Hansson
HOT-DEPLOY, as far as I understand, is the ability to change ON-THE-FLY what's currently deployed without redeploying it. I guess RedHat documentation call HOT-DEPLOY to the ability of deploy anything without RESTARTING the application server. Maybe I am wrong. Do you use Eclipse? Give MyEclipse a try. There is a 30-day trial and it's pretty cheap if you decide to go for it.
Pablo Santa Cruz
A: 

I have had the same problem, but think I've got it under control now.

Are you using eclipse or command line or ??

When I use the command line, I think I did "seam clean" or "seam undeploy" or maybe even "seam restart" followed by "seam explode". I probably tried all of these at one time or another never bothering to look up what each one does.

The idea is to remove the deployed war file from TWO places

1. $JBOSS_HOME/server/default/deploy
2. $PROJECT_HOME/exploded_archives

I'm pretty sure "seam undeploy" removes the 1st and "seam clean" removes the 2nd.

When I use eclipse (I use the free one), I first turn off "Project/Build Automatically" Then when I am ready to deploy I do either Project/Build Project or Project/Build All depending on what I've changed. When I change xhtml, Build Project is sufficient. When I change java source Build All works. It's possible these do the same things and the difference is in my imagination, but some combination of this stuff will work for you.

You have to watch the output though. Occasionally the app does not get cleaned or undeployed. This would result in not seeing your change. Sometimes I shut down the server first and then rebuild/clean/deploy the project.

Hope this helps.

TDR