Skip to main content

Undeploy on Glassfish causes connection pool to be no more usable

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
Anonymous

Hi,

I'm working on a grails 2.2.1 project running on glassfish 3.1.2.2,
using a jndi pooled datasource connected to a postgres 9.2 database.
When I deploy for the first time the application, I have no issues,
everything works fine.

But, everytime I undeploy (or redeploy) my application, my connection
pool stops working.
If I try to ping using glassfish admin console, I get this error :

Avertissement: RAR8054: Exception while creating an unpooled [test] connection for pool [ sample ], Connection could not be allocated because: No suitable driver found for jdbc:postgresql://localhost:5432/sample?loginTimeout=0&socketTimeout=0&prepareThreshold=5&unknownLength=2147483647&loglevel=0&tcpkeepalive=false
Grave: RestResponse.getResponse() donne FAILURE. endpoint = http://localhost:4848/management/domain/resources/ping-connection-pool.json ; attrs = {id=sample}'

I repeat : my connection pool works fine when I deploy (I have the
postgresql driver in "/glassfish/lib", my connection pool is correctly
configured, etc.), it's only when I undeploy that I have troubles.
This bug is highly reproductible, I even did a small grails project that
reproduces the problem, you only need to have to configure a jndi
datasource connected to a "sample" database (jndi/sample) on your
glassfish server.

Here is the github link :
https://github.com/fabier/GlassfishJDBCGrailsPostgresql
And the war :
https://www.dropbox.com/s/cb9hmgc6lfabl5x/GlassfishJDBCGrailsPostgresql-...
and the domains.xml file:
https://www.dropbox.com/s/ljealpfp0zxj2r4/domain.xml

On grails side, my connection to the pool is configured this way:

environments {
production {
dataSource {
dbCreate = "create-drop"
jndiName = "jdbc/sample"
}
}
}

I think this bug is severe, since it kills a connection pool that can be
shared amongst other webapps or ears.
For information, I did a bit of research, sensing it might be some sort
of class unloader associated with undeployment, I found log4j that could
be linked to this problem, so I tryed :
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
but it didn't help.
Last point : in fact, postgresql driver is fully unloaded, so that other
connection pools using postgresql driver are not usable after an undeploy.

Link to same issue in Glassfish's Jira:
http://java.net/jira/browse/GLASSFISH-20094

Link to same issue in Grails Mailing List:
http://grails.1312388.n4.nabble.com/Undeploy-on-Glassfish-causes-connect...

Please help.
Thanks.
--
Pierre FABIER
Ingénieur d'Etude
Parc technologique du canal
13, avenue de l'Europe
31520 Ramonville-Saint-Agne (France)
Tel: 09 74 77 14 21 - Fax: 09 59 64 78 74
www.camineo.com