Java-EE6: how to automatically redeploy a Glassfish 3 application from inside a server component?

I have a three-tier application design with Glassfish 3.1.2.2, MySQL 5.5 Server and a stand-alone Swing client application.

I am currently facing the problem of automatically updating / redeploying a server-side application (* .ear-file) on Glassfish.

My clients periodically check for new updates on my update server, where I put the updated files (client-jar files and server-ear files). As soon as a new version appears, the client downloads it from my update server and saves it in the database that is connected to the Glassfish instance.

My question is how to programmatically redeploy a new * .ear file in Glassfish?

I tried a workaround by opening a new process and using the asadmin tool that came with Glassfish to force the redistribution:

Runtime.getRuntime().exec("./asadmin --user admin --passwordfile "+getPathToPwdFile()+" deploy --force=true "+getPathToNewEarFile()); 

But this solution is unpleasant, because during the redistribution the process breaks down before the process is completed, because the server application, which is a forked process, is redistributed ... This leads to some errors on the application server.

The JMX / AMX project for Glassfish v3 seems dead (latest update 2009) ...

Does anyone have the right solution to this problem?

+4
source share
1 answer

How about programmatically copying an ear file to the Auto Glassfish autorun folder? The default auto-deployment check interval is every 2 seconds, but you can increase it to give your process enough time to complete.

See http://docs.oracle.com/cd/E18930_01/html/821-2417/gilfm.html#fvxze

+2
source

All Articles