tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Maggs" <james.ma...@virgin.net>
Subject Tomcat Ignoring JNDI Resource Parameters
Date Tue, 29 Apr 2003 09:57:30 GMT
Hi There,

I've been struggling with a JNDI DataSource setup under Tomcat 4.1.18. The
problem seems to be that while the <Resource> tag is processed, the
<ResourceParams> are completely ignored. Output in my log file confirms
this. Here's the relevant portion of my server.xml:

      <Host name="www.myhost.com" debug="0"
       appBase="webapps" unpackWARs="true" autoDeploy="true">

        <Context path="" docBase="/usr/local/www/myhost.com/htdocs"
          reloadable="true" crossContext="true" debug="5"/>

        <Logger className="org.apache.catalina.logger.FileLogger"
          prefix="localhost_myhost_log." suffix=".txt" timestamp="true"/>

        <Valve className="org.apache.catalina.valves.AccessLogValve"
          directory="logs"  prefix="myhost_access_log." suffix=".txt"
          pattern="common" resolveHosts="false"/>

        <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
          driverName="org.gjt.mm.mysql.Driver"
          connectionURL="jdbc:mysql://localhost:3306/DB"
          connectionName="user"
          connectionPassword="password"
          userTable="USERS" userNameCol="USERNAME" userCredCol="PASSWORD"
          userRoleTable="USER_ROLES" roleNameCol="ROLENAME" />

        <Resource name="jdbc/MyhostDB"
          auth="Container"
          type="javax.sql.DataSource"/>

        <ResourceParams name="jdbc/MyhostDB">
          <parameter>
            <name>factory</name>
            <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
          </parameter>
          <parameter>
            <name>maxActive</name>
            <value>50</value>
          </parameter>
          <parameter>
            <name>maxIdle</name>
            <value>10</value>
          </parameter>
          <parameter>
            <name>maxWait</name>
            <value>10000</value>
          </parameter>
          <parameter>
            <name>username</name>
            <value>user</value>
          </parameter>
          <parameter>
            <name>password</name>
            <value>password</value>
          </parameter>
          <parameter>
            <name>driverClassName</name>
            <value>org.gjt.mm.mysql.Driver</value>
          </parameter>
          <parameter>
            <name>url</name>
            <value>jdbc:mysql://localhost:3306/DB?autoReconnect=true</value>
          </parameter>
        </ResourceParams>

      </Host>

And in my localhost_myhost_log.txt file I see the following:

NamingContextListener[/localhost/www.seeran.com]: Creating JNDI naming
context
NamingContextListener[/localhost/www.seeran.com]:   Resource parameters for
jdbc/SeeranDB = null
NamingContextListener[/localhost/www.seeran.com]:   Adding resource ref
jdbc/SeeranDB
NamingContextListener[/localhost/www.seeran.com]:
ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factory
ClassName=org.apache.naming.factory.ResourceFactory,{type=description,conten
t=DB
Connection},{type=scope,content=Shareable},{type=auth,content=Container}]
NamingContextListener[/localhost/www.seeran.com]:   Resource parameters for
UserTransaction = null

Tomcat starts up without any errors and the default DataDource is created
under the correct JNDI location but as soon as I try and get a connection a
NullPointerException is thrown. Not surprising given that the properties are
ignored. Can anyone see a problem with my configuration?

Many thanks in advance,

-James



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message