views:

1413

answers:

1

Hi, i have an spring web application (on glassfish server) that use JDBC connection pool. It defined in XML file like this:

<resources>
    <jdbc-connection-pool allow-non-component-callers="true" associate-with-thread="true"
                          connection-creation-retry-attempts="2" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false"
                          connection-leak-timeout-in-seconds="0" connection-validation-method="table" datasource-classname="oracle.jdbc.pool.OracleConnectionPoolDataSource"
                          fail-all-connections="false" idle-timeout-in-seconds="2147483638" is-connection-validation-required="true"
                          is-isolation-level-guaranteed="false" lazy-connection-association="true" lazy-connection-enlistment="true"
                          match-connections="false" max-connection-usage-count="0" max-pool-size="60" max-wait-time-in-millis="60000"
                          name="company.jdbc.sc.nonxa.pool" non-transactional-connections="false" pool-resize-quantity="2"
                          res-type="javax.sql.ConnectionPoolDataSource" statement-timeout-in-seconds="300" steady-pool-size="16"
                          transaction-isolation-level="read-committed" validate-atmost-once-period-in-seconds="1" validation-table-name="SC_VALIDATE"
                          wrap-jdbc-objects="false">
        <property name="DataSourceName" value="OracleNonXADataSource"/>
        <property name="ImplicitCachingEnabled" value="false"/>
        <property name="NetworkProtocol" value="tcp"/>
        <property name="Password" value="password"/>
        <property name="LoginTimeout" value="0"/>
        <property name="URL" value="jdbc:oracle:thin:@oradbdev.company.ru:1521:COMPANY"/>
        <property name="NativeXA" value="false"/>
        <property name="User" value="prog10"/>
        <property name="ExplicitCachingEnabled" value="false"/>
        <property name="PortNumber" value="0"/>
        <property name="MaxStatements" value="0"/>
    </jdbc-connection-pool>
    <jdbc-resource enabled="true" jndi-name="company.jdbc.sc.nonxa.db" object-type="user" pool-name="company.jdbc.sc.nonxa.pool"/>
</resources>

And now i need to start application inside embedded Jetty server for integration test. I'm trying to add connection pool in jetty.xml file like this:

<New id="DS" class="org.mortbay.jetty.plus.naming.Resource">
    <Arg>
        <Ref id="wac"/>
    </Arg>
    <Arg>jdbc/DS</Arg>
    <Arg>
        <New class="oracle.jdbc.pool.OracleConnectionPoolDataSource">
            <Set name="DataSourceName">OracleNonXADataSource</Set>
            <Set name="ImplicitCachingEnabled">false</Set>
            <Set name="NetworkProtocol">tcp</Set>
            <Set name="Password">password</Set>
            <Set name="LoginTimeout">0</Set>
            <Set name="URL">jdbc:oracle:thin:@oradbdev.company.ru:1521:COMPANY</Set>
            <Set name="NativeXA">false</Set>
            <Set name="User">prog10</Set>
            <Set name="ExplicitCachingEnabled">false</Set>
            <Set name="PortNumber">0</Set>
            <Set name="MaxStatements">0</Set>
        </New>
    </Arg>
</New>

It register connection pool, but i also nee to register jdbc-resource with given name.

How i can to do that?

A: 

With Jetty, you set the JNDI name of the connection pool in the configuration (here, jdbc/DS). So why would you need to register a "jdbc-resource"? This seems to be a specific step to GlassFish.

Pascal Thivent
i register this datasource in webxml with name, but have an error.Embedded error: Object is not of type class org.mortbay.jetty.webapp.WebAppContextHow can i fix it?
Chupa
What version of jetty are you using?
Pascal Thivent