I have been testing out GN 2.4.2 on a live Tomcat 6.0.18 server (Linux) for the past few weeks, and have noticed a problem which arises as a result of the application being idle longer than a certain time. I understand why it happens (it is to do with stale Postgres database connections in a pool which the app thinks are still alive, but which our firewall thinks are not). The result of this is that any access to GN hangs (the logs report that the correct request was sent, just that nothing ever returns). There are reports from the JDBC backend of timeouts and "NoRouteToHostException". The relevant portion of my GN config.xml is:
<resource enabled="true">
<name>main-db</name>
<provider>jeeves.resources.dbms.DbmsPool</provider>
<config>
<user>username</user>
<password>password</password>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://servername:5432/geonetwork</url>
<poolSize>10</poolSize>
</config>
</resource>
Is there a way round this using an extra config parameters in the config.xml file, e.g. to validate connections in the pool before attempting to use them? I'd appreciate a pointer as to where to look to find out what other parameters are available for config. It seems from Jeeves docs that I *could* change the provider over (e.g. to javax.sql.DataSource?). The thinking behind this is that I could use a JNDI resource defined in the Tomcat application Context e.g:
<Resource name="jdbc/Geonetwork"
type="javax.sql.DataSource"
initialSize="20"
maxActive="100"
maxIdle="4"
minIdle="0"
maxWait="60000"
validationQuery="SELECT 1"
removeAbandoned="true"
removeAbandonedTimeout="60"
password="password"
driverClassName="org.postgresql.Driver"
username="username"
url="jdbc:postgresql://servername:5432/geonetwork"
/>
This allows for connection validation and discarding of invalid ones. I would like to know if anyone has got GN to run with JNDI database connection pooling rather than the Jeeves default (or whether it's even possible!). Is this a realistic possibility, or am I in the business of creating my own custom version of the source?
With thanks,
David Herbert
British Antarctic Survey.