tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Mixon" <rnmi...@qwest.net>
Subject RE: Tomcat 5.5.17: context.xml-mysteries
Date Wed, 11 Oct 2006 22:15:08 GMT
Gregor,
I believe you've got it backwards. The correct syntax for Tomcat 5.5 is your
"working context.xml".
See:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html

-----Original Message-----
From: Gregor Schneider [mailto:rc46fi@googlemail.com] 
Sent: Wednesday, October 11, 2006 1:53 PM
To: Tomcat Users List
Subject: Tomcat 5.5.17: context.xml-mysteries

Hi list,

a simple question, where I hope somebody could shed some light upon my head:

I've specified  [webapp]/META-INF/context.xml, where I defined the
connection-pool and the datasource that should be used.

However, when I'm using the old format of the element "Resource", everything
runs smooth, but if I'm using the new format with "ResourceParams", the
datasource is not found and I'm getting a NPE within my web-app.

I've looked over the files again and again and again and I can't see any
difference within it's contents. Do I miss something here, do I have some
tomatoes upon my eyes, is this a feature or just a bug???

The working context.xml:
==================

<?xml version="1.0" encoding="UTF-8"?>
<Context>
  <Resource
    auth="Container"
    description="DB Connection for SSO"
    name="jdbc/SSODS"
    type="javax.sql.DataSource"
    factory="org.apache.commons.dbcp.BasicDataSourceFactory"
    driverClassName="com.mysql.jdbc.Driver"
    username="username"
    password="password"
    url="jdbc:mysql://localhost/apacheSSO"
    maxIdle="5"
    maxWait="10000"
    maxActive="10"
    validationQuery="SELECT 1"
    testOnBorrow="true"
    testWhileIdle="true"
    timeBetweenEvictionRunsMillis="10000"
    minEvictableIdleTimeMillis="28800"
    poolPreparedStatements="true"
    removeAbandoned="true"
    removeAbandonedTimeout="300"
    logAbandoned="true"/>
</Context>

The NPE-version of the same file:
========================

<?xml version="1.0" encoding="UTF-8"?>
<Context>
  <Resource name="jdbc/SSODS"
               auth="Container"
               type="javax.sql.DataSource"/>

  <ResourceParams name="jdbc/SSODS">

    <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>

    <parameter>
      <name>maxActive</name>
      <value>10</value>
    </parameter>

    <parameter>
      <name>maxIdle</name>
      <value>5</value>
    </parameter>

    <parameter>
      <name>validationQuery</name>
      <value>SELECT 1</value>
    </parameter>

    <parameter>
      <name>testOnBorrow</name>
      <value>true</value>
    </parameter>

    <parameter>
      <name>testWhileIdle</name>
      <value>true</value>
    </parameter>

    <parameter>
      <name>timeBetweenEvictionRunsMillis</name>
      <value>10000</value>
    </parameter>

    <parameter>
      <name>minEvictableIdleTimeMillis</name>
      <value>28800</value>
    </parameter>

    <parameter>
     <name>password</name>
     <value>password</value>
    </parameter>

    <parameter>
       <name>driverClassName</name>
       <value>com.mysql.jdbc.Driver</value>
    </parameter>

    <parameter>
      <name>url</name>
      <value>jdbc:mysql://localhost:3306/apacheSSO</value>
    </parameter>

    <parameter>
      <name>poolPreparedStatements</name>
      <value>true</value>
    </parameter>

    <parameter>
        <name>removeAbandoned</name>
        <value>true</value>
    </parameter>

    <parameter>
        <name>removeAbandonedTimeout</name>
        <value>300</value>
    </parameter>

    <parameter>
        <name>logAbandoned</name>
        <value>true</value>
    </parameter>

    </ResourceParams>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <WatchedResource>META-INF/context.xml</WatchedResource>
</Context>

PS.: JDK is  1.5.0_07-b03, OS is Debian Sarge

TIA

Greg
--
what's puzzlin' you, is the nature of my game


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message