Merrill,
Much of what you're doing is just beyond me but I can't help but noticing
this in your first post.
<parameter>
<name>password</name>
<value>xxxxxxxxxxx</value>
</parameter>
Since you've included a password value in all the other places I'm wondering
if the lack of it here could be part of the problem.
Sorry if I'm way off base,
Ken
-----Original Message-----
From: Merrill Cornish [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 10, 2004 5:25 PM
To: [EMAIL PROTECTED]
Subject: Another Try at MySQL Connection Pooling
I'm running
* Tomcat 5.0.18 running as a Wndows service,
* MySQL 4.0.16 running as a Windows service, and
* MySQL Connector/J 3.0.10 stable
all on Windows 2000 Server, which is where I'm also doing the testing (i.e.,
on localhost).
A number of tomcat-user mailing list denizens have given me snippets of XML
to put in various places. Nothing worked. So I tried following the "MySQL
Configuration" example from
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how
to.html. After all changes were made to server.xml, web.xml and
timesheet.xml (the <context> fragment under conf/Catalina/localhost), I
restarted Tomcat and tried to login (the first action that would have had to
touch the MySQL database).
I got the following errorPage:
> At Timesheet.Util.errorPage(Util.java:550) there occurred a
> java.lang.Exception: A fatal exception occurred while retrieving login
name and pass phrase because...
>
> At Timesheet.Util.getSqlConnection(Util.java:492) there occurred a
> java.lang.Exception: Unable to establish a MysqlDataSource connection for
ResourceLine name "jdbc/TimesheetsDB" >because...
>
> At org.apache.naming.NamingContext.lookup(NamingContext.java:814) there
occurred a
> javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
OK, that seems to say it doesn't know what the name "jdbc/TimesheetsDB" is.
Tomcat has written nothing to stderr.log and stdout.log shows a clean
startup, so Tomcat itself isn't too perturbed. stdout.log includes the
following line:
> INFO: Processing Context configuration file URL file:C:\Program
Files\Apache Group\Tomcat 5.0.18\conf\Catalina\localhost\timesheet.xml
implying that my timesheet.xml context fragment file was found and
processed. The Timesheet application log file contains the following:
> 2004-02-10 16:20:05 NamingContextListener[/Catalina/localhost/timesheet]:
Resource parameters for jdbc/TimesheetsDB =
ResourceParams[name=jdbc/TimesheetsDB,
parameters={factory=org.apache.commons.dbcp.BasicDataSourceFactory,
url=jdbc:mysql://localhost/Timesheets?autoReconnect=true&socketFactory=com.m
ysql.jdbc.NamedPipeSocketFactory, password=All41a14all, maxWait=10000,
maxActive=100, driverClassName=org.gjt.mm.mysql.Driver,
username=timesheet_app, maxIdle=30}]
> 2004-02-10 16:20:05 NamingContextListener[/Catalina/localhost/timesheet]:
Adding resource ref jdbc/TimesheetsDB
> 2004-02-10 16:20:05 NamingContextListener[/Catalina/localhost/timesheet]:
ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factory
ClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Shar
eable},{type=auth,content=Container},{type=factory,content=org.apache.common
s.dbcp.BasicDataSourceFactory},{type=url,content=jdbc:mysql://localhost/Time
sheets?autoReconnect=true&socketFactory=com.mysql.jdbc.NamedPipeSocketFactor
y},{type=password,content=All41a14all},{type=maxWait,content=10000},{type=ma
xActive,content=100},{type=driverClassName,content=org.gjt.mm.mysql.Driver},
{type=username,content=timesheet_app},{type=maxIdle,content=30}]
> 2004-02-10 16:20:05 NamingContextListener[/Catalina/localhost/timesheet]:
Resource parameters for UserTransaction = null
[Blank lines added for clarity.] As per the instructions in the
jndi-datasource-examples-howto.html page, my web.xml file has the following
addition
> <resource-ref>
> <description>MySql Connection Pool</description>
> <res-ref-name>jdbc/TimesheetsDB</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
immediately after the <error-page> element and immediately before the
<security-constraint> element.
Now that I am using the timesheet.xml <context> fragment file, server.xml is
unchanged except that I have modified it to use port 80 in place of 8080 and
port 443 in place of 8443.
The timesheet.xml <context> fragment file looks like this:
<Context path="/timesheet" docBase="timesheet" debug="9" reloadable="true"
crossContext="true" displayName="ConnectTel Timesheet Application">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_timesheet_log." suffix=".txt" timestamp="true"/>
<Resource name="jdbc/TimesheetsDB" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/TimesheetsDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name> <!-- max db connections in the pool -->
<value>100</value> <!-- 0 implies no limit -->
</parameter>
<parameter>
<name>maxIdle</name> <!-- max idle db connections to retain in pool
-->
<value>30</value> <!-- 0 implies no limit -->
</parameter>
<parameter>
<name>maxWait</name> <!-- max wait for connection before throwing
exception -->
<value>10000</value> <!-- -1 implies no limit (time is in
milliseconds) -->
</parameter>
<parameter>
<name>username</name>
<value>timesheet_app</value>
</parameter>
<parameter>
<name>password</name>
<value>xxxxxxxxxxx</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost/Timesheets?autoReconnect=true&socketFactor
y=com.mysql.jdbc.NamedPipeSocketFactory</value>
</parameter>
<parameter>
<name>driverClassName</name> <!-- Class name for mm.mysql JDBC driver
-->
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
</ResourceParams>
</Context>
I apologize for being so verbose, but I'm trying to provide all of the
relevant information in the initial message. Does anyone see what I've
missed? The example in jndi-datasource-examples-howto.html does NOT look
like the other things I was told to do. (?)
Merrill
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]