Skip to content

Instantly share code, notes, and snippets.

@fvanderbiest
Created August 18, 2023 15:21
Show Gist options
  • Save fvanderbiest/278163376791d7929ac0a2417a37f413 to your computer and use it in GitHub Desktop.
Save fvanderbiest/278163376791d7929ac0a2417a37f413 to your computer and use it in GitHub Desktop.
JNDI resource configuration for GeoServer
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<New id="ds_geoserver" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/geoserver</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">org.postgresql.Driver</Set>
<Set name="username">geoserver</Set>
<Set name="password">pass</Set>
<Set name="url">jdbc:postgresql://database/dbname</Set>
<Set name="validationQuery">SELECT 1</Set>
<Set name="maxWait">10000</Set>
<Set name="maxActive">100</Set>
<Set name="maxIdle">10</Set>
<Set name="accessToUnderlyingConnectionAllowed">true</Set>
</New>
</Arg>
</New>
</Configure>
Include the following in GeoServer's web.xml:
<resource-ref>
<description>Connection Pool</description>
<res-ref-name>jdbc/geoserver</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment