[Geoserver-devel] [jira] Created: (GEOS-3268) Add Jetty JNDI support for debugging

Add Jetty JNDI support for debugging
------------------------------------

                 Key: GEOS-3268
                 URL: http://jira.codehaus.org/browse/GEOS-3268
             Project: GeoServer
          Issue Type: Improvement
          Components: Global
    Affects Versions: 2.0.x
            Reporter: Ben Caradoc-Davies
            Assignee: Andrea Aime
             Fix For: 2.0.x
         Attachments: web-app-jetty-jndi.patch

Attached patch adds Jetty JNDI support to allow JNDI data sources to be used while testing GeoServer under Jetty (for example, in Eclipse).

If a system property jetty.config.file is set, it is used as a filename to load as a jetty server configuration. This permits debugging under Jetty with an external configuration, without including anything Jetty-specific in the GeoServer WEB-INF.

For example, you might set a system property jetty.config.file in an Eclipse launcher for Start.jar, by adding the VM argument
{code}
-Djetty.config.file=../../../../../settings/jetty.xml
{code}
The path is relative to the root of the web-app module (in which the launcher runs.

The settings file jetty.xml might look like this
{code}
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd&quot;&gt;

<Configure class="org.mortbay.jetty.Server">

    <New class="org.mortbay.jetty.plus.naming.Resource">
        <Arg>jdbc/demo</Arg>
        <Arg>
            <New class="org.apache.commons.dbcp.BasicDataSource">
                <Set name="driverClassName">oracle.jdbc.driver.OracleDriver</Set>
                <Set name="url">jdbc:oracle:thin:@oracle.example.com:1521:demodb</Set>
                <Set name="username">claudius</Set>
                <Set name="password">s3cr3t</Set>
                <Set name="maxActive">20</Set>
                <Set name="maxIdle">10</Set>
                <Set name="minIdle">0</Set>
                <Set name="maxWait">10000</Set>
                <Set name="minEvictableIdleTimeMillis">300000</Set>
                <Set name="timeBetweenEvictionRunsMillis">300000</Set>
                <Set name="numTestsPerEvictionRun">20</Set>
                <Set name="poolPreparedStatements">true</Set>
                <Set name="maxOpenPreparedStatements">100</Set>
                <Set name="testOnBorrow">true</Set>
                <Set name="validationQuery">SELECT SYSDATE FROM DUAL</Set>
                </New>
        </Arg>
    </New>

</Configure>
{code}

Note that the config is applied at the server level (not a single context). Jetty does not mandate a reference-ref in WEB-INF/web.xml, so there is no need to modify it. Note also that the jetty-plus Server is not being used, just the plain jetty Server (as before). Moving to jetty-plus Server might enable more features, such as jetty configs in WEB-INF. This is outside the scope of this improvement.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira