Yeah it's 5.5.15.
It's strange that because I'm advised to actually change the server.xml file
in the guide to setting up a JNDI Source on the Tomcat website. My
server.xl file is in a bit of a state though so I've attached it to this
email see if I've set it up right as it says here:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
Mark
----- Original Message -----
From: "Rose, Greg" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Monday, February 20, 2006 12:33 PM
Subject: RE: JNDI Datasource Problem
What release of Tomcat are you using?
If it is 5.5.x, you can not alter the Server.xml file. You will need to
create a context file and place it into your META_INF directory in your
application. Tomcat will place it into your
CATALINA_HOME\conf\Catalina\localhost directory when the application is
started.
-----Original Message-----
From: chuanjiang lo [mailto:[EMAIL PROTECTED]
Sent: Monday, February 20, 2006 7:25 AM
To: Tomcat Users List
Subject: Re: JNDI Datasource Problem
i think you would need to change the context.xml?
On 2/20/06, Mark Whitby <[EMAIL PROTECTED]> wrote:
Hey guys,
Thanks for the help with the previous problem I had, I've managed to
solve
them now thanks to your help. But now I'm having a problem with
setting up
a DataSource connection. I've followed the example word for word and
got
the following error:
javax.servlet.ServletException: Unable to get connection, DataSource
invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
create
JDBC driver of class '' for connect URL 'null'"
I did a google search for this but only managed to find something on
the
NetBeans website which wasn't much help. I've edited the server.xml
file
as stated, placed the relevent jar file (
mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web
application and in the /common/lib folder in the Tomcat home folder
and I've
reset the server and I'm still getting the same problem.
I'm using MySQL, database is called 'fyptest' and the table is called
'testdata'. So where am I going wrong?
Many thanks
Mark Whitby
Server.xml file:
<Context path="/DBTest" docBase="DBTest"
debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_DBTest_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/TestDB"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/TestDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
-->
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<!-- Maximum number of idle dB connections to retain in pool.
Set to -1 for no limit. See also the DBCP documentation on
this
and the minEvictableIdleTimeMillis configuration parameter.
-->
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<!-- Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<!-- MySQL dB username and password for dB connections -->
<parameter>
<name>username</name>
<value>javauser</value>
</parameter>
<parameter>
<name>password</name>
<value>pilks2</value>
</parameter>
<!-- Class name for the old mm.mysql JDBC driver - uncomment this
entry and comment next
if you want to use this driver - we recommend using
Connector/J
though
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
-->
<!-- Class name for the official MySQL Connector/J driver -->
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<!-- The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that
the
mm.mysql JDBC Driver will automatically reconnect if mysqld
closed the
connection. mysqld by default closes idle connections after
8
hours.
-->
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/fyptest?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>
web.xml file:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/TestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
This electronic message transmission contains information from the Company
that may be proprietary, confidential and/or privileged.
The information is intended only for the use of the individual(s) or entity
named above. If you are not the intended recipient, be
aware that any disclosure, copying or distribution or use of the contents of
this information is prohibited. If you have received
this electronic transmission in error, please notify the sender immediately
by replying to the address listed in the "From:" field.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<?xml version="1.0" encoding="UTF-8"?>
<Server>
<Listener className="org.apache.catalina.core.AprLifecycleListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
<GlobalNamingResources>
<Environment
name="simpleValue"
type="java.lang.Integer"
value="30"/>
<Resource
auth="Container"
description="User database that can be updated and saved"
name="UserDatabase"
type="org.apache.catalina.UserDatabase"
pathname="conf/tomcat-users.xml"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/>
</GlobalNamingResources>
<Service
name="Catalina">
<Connector
port="8080"
redirectPort="8443"
minSpareThreads="25"
connectionTimeout="60000"
connectionLinger="-1"
serverSoTimeout="0"
maxSpareThreads="75"
maxThreads="150"
tcpNoDelay="true"
maxHttpHeaderSize="8192">
</Connector>
<Connector
port="8443"
scheme="https"
secure="true"
minSpareThreads="25"
connectionTimeout="60000"
clientAuth="false"
keystorePass="?MtHw7!"
connectionLinger="-1"
serverSoTimeout="0"
keystoreFile="D:\FYPCode\keystore"
maxSpareThreads="75"
maxThreads="150"
tcpNoDelay="true"
maxHttpHeaderSize="8192"
sslProtocol="TLS">
</Connector>
<Connector
port="8009"
redirectPort="8443"
protocol="AJP/1.3">
</Connector>
<Engine
defaultHost="localhost"
name="Catalina">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
<Host
appBase="webapps"
name="localhost">
<Valve className="org.apache.catalina.valves.AccessLogValve"
fileDateFormat="yyyy-MM-dd"
prefix="localhost_access_log."
suffix=".txt"/>
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
fileDateFormat="yyyy-MM-dd"
prefix="localhost_access_log."
suffix=".txt"/>
<Context path="/DBTest" docBase="DBTest"
debug="5" reloadable="true" crossContext="true">
<!-- maxActive: Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
-->
<!-- maxIdle: Maximum number of idle dB connections to retain in pool.
Set to -1 for no limit. See also the DBCP documentation on this
and the minEvictableIdleTimeMillis configuration parameter.
-->
<!-- maxWait: Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
<!-- username and password: MySQL dB username and password for dB connections -->
<!-- driverClassName: Class name for the old mm.mysql JDBC driver is
org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver.
-->
<!-- url: The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
connection. mysqld by default closes idle connections after 8 hours.
-->
<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="javauser" password="pilks2" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/fyptest?autoReconnect=true"/>
</Context>
</Host>
</Engine>
</Service>
</Server>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]