Quantcast

Undeploy on Glassfish causes connection pool to be no more usable

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Undeploy on Glassfish causes connection pool to be no more usable

Pierre FABIER
This post was updated on .
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-0.1.war
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

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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Undeploy on Glassfish causes connection pool to be no more usable

Pierre FABIER
Re,

I did some investigations:
 - If I use MySQL instead of PostgreSQL (after changing the driver and re-configuring the pool), I cannot reproduce this problem. So PostgreSQL is involved in this problem too.
 - If I use Tomcat instead of Glassfish, I cannot reproduce this problem. So Glassfish is involved.
 - If I do not use grails, and deploy a standard J2EE app like «petstore» (link) using PostgreSQL jndi datasource, I cannot reproduce the problem. So Grails is involved too.

 - If I use Glassfish 3.0, Glassfish 3.1 or Glassfish 3.1.2.2, I still reproduce the problem, so the version of glassfish doesn't change anything.
 - If I use PostgreSQL 9.0, PostgreSQL 9.1 or PostgreSQL 9.2, I still reproduce the problem, so the version of PostgreSQL doesn't change anything.

 - Most incredible thing I discovered (that made me fall out of my chair) : If I undeploy a grails app using a MySQL datasource on a glassfish server that declares a UNUSED connection pool to a PostgreSQL database, the MySQL pool still works, but the PostgreSQL pool doesn't !!! it shows the «No suitable driver found» error, as there was no problem prior to undeploying.

Please help me, I'm stuck with this problem, and no one seems to be able to answer me.

--
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
Loading...