adam bien's blog

Real Time deployment monitoring with glassfish 📎

In the past I used the autodeployment feature heavily with JBoss and WLS in the development phase.
Autodeployment means: the application server scans a defined folder for new deployment artifacts every couple of seconds.
In case the content of the folder changes, the application server redeploys the whole application (=changed ear or ejb-jar).
The problem here: you have to wait a couple of seconds until the application is available for testing.
You can, of course, hit the reload button every couple of seconds. I tried something different with glassfish,
which works well for me. I use JConsole (a part of Java SE 5) to monitor the deployment state and success in real time.
To achieve this, you need only the serviceurl, which is suggested by the glassfish in the boot phase.
In my case the url is: service:jmx:rmi:///jndi/rmi://merlin:8686/jmxrmi. merlin is the name of my machine,
so you have only to replace it. In the MBean tab you find the StatelessSessionBean folder, which is synchronized in real time
with the deployment progress.

You can also watch the screencast to see how it looks like.

Regardless how well it works, you should not always trust it. Redeployment relies on unloading and loading classes dynamically,
which is not trivial. So if the structure of the application (EJB3) changes significantly,
I would restart the server and not rely on autodeployment features.