views:

379

answers:

1

I realized that any application which uses hibernate, fails to undeploy completely in Glassfish 2.1.1. Many classes remain in memory after the undeployment process, you can check it using jmap and jhat.

I've done several tests, and figured out that only applications which had hibernate failed to have a clen undeploy process. My Database provider for Hibernate in all the cases were jTDS 1.2.5.

You don't even need to run the application. If you just deploy, and instantly undeploy, you will realize several classes in memory, many from your application and many from hibernate and its dependencies.

Is it possible to have a clean undeploy in Glassfish v2.1.1? I'm running out of permgen space all the time.

A: 

This is not a definitive answer, but it can at least minimize glassfish related undeployement issues, if you are using hibernate:

  • Don't use enums in your entities. Create regular classes instead.
  • Annotate only methods, don't annotate properties.

These two items can help minimizing problems, but don't get them rid of your development environment. Even if you don't use hibernate, your sesion beans stay forever in memory even after undeployement.