views:

188

answers:

3

What is the proper way to redeploy a new version of a running app in glassfish? I have a WAR running, and I've made changes. I thought doing an undeploy + deploy might be the right thing, but glassfish (v3) often crashes when I undeploy.

What' the proper way to redeploy a running app in glassfish?

A: 

Don't know why v3 should be different but in v2 that's exactly what we do. We first undeploy then deploy again.

Do you use the admin GUI or asadmin (command line) to do this? Is the behavior the same both ways?

nzpcmad
+1  A: 

undeploy means removing all traces of a web application:

  • its classloader
  • compiled JSPs
  • file persisted HTTP sessions

When does your problem occur? Does GlassFish really crash? Can you give us more details.


For the record, GlassFish v3 has a redeploy command:

asadmin redeploy --name mywar mywar.war

But since redeploy = undeploy + deploy, this won't solve your problem.

Pascal Thivent
+2  A: 

There are a number of ways to redeploy a web application onto GlassFish v3.

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

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

I hardly ever undeploy then deploy.... it takes too long.

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

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

I like to use the keepSessions property while I am doing development. I don't know whether this property would be useful in a production situation.

The method that you described probably should not crash the server... Please file an issue at https://glassfish.dev.java.net/servlets/ProjectIssues so folks on the team can track down what the problem might be.

vkraemer
@vkraemer - Great hints, thanks.
Robot