When a class file change, Can I make the glassfish

2019-07-30 00:14发布

问题:

When a class file change, Can I make the glassfish server not restart but still reflect the change ?

I mean the glassfish sever doesn't redeployment(or publish) the application, but only redeployment the class that has changed.

回答1:

If this is meant to be done while development, you can give a shot to JRebel.



回答2:

There are a number of ways to redeploy an application onto GlassFish 3.1 that do not require that you restart the server.

The method I would recommend is 'asadmin redeploy --name foo --keepstate=true foo.war' (or use directory deployment for the web app...)

You can look at the man page for the redeploy subcommand of asadmin to learn more about the details.

I hardly ever create a deployable archive file.... I usually do directory deployment, which eliminates the time that would get used up creating and then exploding the archive file.

By using directory deployment I can also apply tweaks to jsp files and other static content to test them without a rebuild/redeploy step.

I like to use the keepstate option while I am doing development.

Another important step that you should take to avoid unnecessary restarts is to move to an open-source OS like Linux or Solaris (away from Windows) which has few file locking problems.