Multiple instances of hibernate.sessionFactory remain on glassfish server after .war redeployment
Atef Ben Nasser
posted 1 year ago
I'm in a bit of trouble, I recently started developping a Java application using spring, maven (3.2.3) and glassfish server (188.8.131.52). I had to test my webservices so I kept deploying then redeploying my generated war file on glassfish.
After a while I noticed glassfish takes longer and longer to deploy, and then I received an error stating glassfish was unable to get database access. After some more redeploys I had an outofmemory PermGen error. So I started profiling my application.
To my surprise I noticed that everytime i redeployed, old instances of classes were still active and were not deleted as it was supposed to happen. Among which are the webappclassLoader and the hibernate.SessionFactoryImpl, resulting hence in the weird behavior I witnessed during the redeployment.
See the picture attached for the profiling result and the 3 instances of hibernate.SessionFactory obtained.
I don't know where to start to solve this issue. I'm a rookie and every help is most welcome.
Thanks in advance !