I have a 3-tiered application design with Glassfish 3.1.2.2, MySQL 5.5 Server and a Stand-alone Swing-based client application.
I am currently facing the problem of how to automatically update / redeploy the server side application (the *.ear-file) on Glassfish.
My clients periodically check for new updates on my update server where I deposit updated files (client-jar-files and server-ear-files). As soon as there is a new version, the client downloads it from my update server and stores it to the database which is connected to the Glassfish instance.
My question is how to programmatically re-deploy the new *.ear file to Glassfish ?
I tried a work-around by opening a new process and using the asadmin tool shipped with Glassfish in order to force a redeploy:
Runtime.getRuntime().exec("./asadmin --user admin --passwordfile "+getPathToPwdFile()+" deploy --force=true "+getPathToNewEarFile());
But this solution is nasty since during redeployment the process gets stripped before the process is terminated, since the server application that forked the process, is redeployed... That leads to some errors on the application server.
JMX / AMX project for Glassfish v3 seems to be dead (last update 2009) ...
Does somebody has a proper solution to this issue ?