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.
Depending on what you change you can even have remote debugging and make use of the hot code replacment to instantly see the effect of changes without any redeployment. Beware: Do not confuse hot deployment (app-server feature) with hot code replacement (JVM feature). Also be aware, that a server restart or a hot deployment most likely undos your hot code replacments.
Posted by Tobias on September 27, 2006 at 05:19 PM CEST #
I do not confused both. I even didn't mentioned the code replacement capabilities. I only explained here the JMX monitoring - nothing else.
Posted by Adam Bien on September 27, 2006 at 10:40 PM CEST #