You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kito Holliday <ho...@phys.psu.edu> on 2005/09/20 00:20:01 UTC
jdbc driver
Attempting to use connector-java-3.3.10 with tomcat 4.0 and mysql and
servlets. The Java code:
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)lookup("jdbc/TestDB");
throws the exception:
Exception creating DataSource: org.hsql.jdbcDriver
The problem is that my .xml files never mentions the hsql jdbcDriver.
Obviously tomcat is ignoring my <context statement>
Specifically, I have a web.xml having:
**************
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<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>
<!-- end tomcat addition -->
***************
and a server.xml having
*****************Sorry for the long server.xml**********
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<Service name="Tomcat-Standalone">
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443" acceptCount="10"
debug="0" connectionTimeout="60000" />
<Engine name="Standalone" defaultHost="localhost" debug="0">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="standaloneEngine_log." suffix=".txt"
timestamp="true"/>
<Realm className="org.apache.catalina.realm.MemoryRealm" />
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" />
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="standaloneHost_log." suffix=".txt"
timestamp="true" />
<Context path="" docBase="ROOT" debug="0" />
<Context path="/manager" docBase="manager" debug="0"
privileged="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="standalone_manager_log." suffix=".txt"
timestamp="true" />
</Context>
<Context path="/examples" docBase="examples" debug="0"
reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="standalone_examples_log." suffix=".txt"
timestamp="true" />
<Environment name="maxExemptions" type="java.lang.Integer"
value="15" />
<Parameter name="context.param.name" value="context.param.value"
override="false" />
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session" />
<ResourceParams name="mail/Session">
<parameter><name>mail.smtp.host</name>
<value>localhost</value>
</parameter>
</ResourceParams>
</Context>
<Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true"
crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="standalone_DBTest_log." suffix=".txt"
timestamp="true" />
<Resource name="jdbc/TestDB" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver" />
<ResourceParams name="jdbc/TestDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>factory</name>
<value>com.mysql.jdbc.jdbc2.optional.
MysqlConnectionPoolDataSource</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>username</name>
<value>javauser</value>
</parameter>
<parameter>
<name>password</name>
<value>javadude</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306
/javatest?autoReconnect=true</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<value>60</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
</ResourceParams>
</Context>
</Host>
</Engine>
</Service>
<Service name="Tomcat-Apache">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="tomcat_apache_service." suffix=".txt"
timestamp="true"/>
<Connector className="org.apache.catalina.connector.warp.WarpConnector"
port="8008" minProcessors="5" maxProcessors="75"
enableLookups="true" appBase="webapps" acceptCount="10"
debug="0" />
<Engine className="org.apache.catalina.connector.warp.WarpEngine"
name="Apache" localHost="127.0.0.1" debug="5">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="tomcatapacheEngine." suffix=".txt" timestamp="true"/>
<Realm className="org.apache.catalina.realm.MemoryRealm" />
<Host name="localhost1" debug="0" appBase="webapps"
unpackWARs="true">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="tomcatapacheHost_log."
suffix=".txt" timestamp="true" />
<Context path="" docBase="ROOT" debug="0" />
<Context path="/DBTest" docBase="DBTest" override="true" debug="5"
reloadable="true" crossContext="true" useNaming="false">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="tomcatapache_DBTest_log." suffix=".txt"
timestamp="true" />
<Resource name="jdbc/TestDB" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
username="javauser" password="javadude"
url="jdbc:mysql://localhost:3306
/javatest?autoReconnect=true"
factory="org.apache.commons.dbcp.
BasicDataSourceFactory"
maxActive="100"
maxIdle="30"
validationQuery="SELECT 1"
testOnBorrow="true"
testWhileIdle="true"
timeBetweenEvictionRunsMillis="10000"
minEvictableIdletime="60000"
maxWait="10000"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true" />
</Context>
- <Context path="/manager" docBase="manager" debug="0"
privileged="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="apachetomcat_manager_log." suffix=".txt"
timestamp="true" />
</Context>
<Context path="/examples" docBase="examples" debug="0"
reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="apachetomcat_examples_log." suffix=".txt"
timestamp="true" />
<Environment name="maxExemptions" type="java.lang.Integer"
value="15" />
<Parameter name="context.param.name" value="context.param.value"
override="false" />
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session" />
<ResourceParams name="mail/Session">
<parameter>
<name>mail.smtp.host</name>
<value>localhost</value>
</parameter>
</ResourceParams>
</Context>
</Host>
</Engine>
</Service>
</Server>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: jdbc driver
Posted by Kito Holliday <ho...@phys.psu.edu>.
Thanks for the quick reply...
Yes the .jar file is in common/lib. I fear the problem lies in the
server.xml since jndi is binding datasource jdbc/TestDB to
org.hsql.jdbcDriver
On Mon, 19 Sep 2005, andy gordon wrote:
> is the MySQL Connector Jar file in the $CATALINA_HOME/common/lib directory?
>
> Kito Holliday <ho...@phys.psu.edu> wrote:Attempting to use connector-java-3.3.10 with tomcat 4.0 and mysql and
> servlets. The Java code:
> InitialContext ctx = new InitialContext();
> DataSource ds = (DataSource)lookup("jdbc/TestDB");
>
> throws the exception:
> Exception creating DataSource: org.hsql.jdbcDriver
>
> The problem is that my .xml files never mentions the hsql jdbcDriver.
> Obviously tomcat is ignoring my
>
> Specifically, I have a web.xml having:
> **************
>
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd">
>
>
> DB Connection
> jdbc/TestDB
> javax.sql.DataSource
> Container
>
>
> ***************
>
> and a server.xml having
>
> *****************Sorry for the long server.xml**********
>
>
>
> port="8080" minProcessors="5" maxProcessors="75"
> enableLookups="true" redirectPort="8443" acceptCount="10"
> debug="0" connectionTimeout="60000" />
>
> prefix="standaloneEngine_log." suffix=".txt"
> timestamp="true"/>
>
>
> directory="logs" prefix="localhost_access_log." suffix=".txt"
> pattern="common" />
> directory="logs" prefix="standaloneHost_log." suffix=".txt"
> timestamp="true" />
>
> privileged="true">
> prefix="standalone_manager_log." suffix=".txt"
> timestamp="true" />
>
> reloadable="true" crossContext="true">
> prefix="standalone_examples_log." suffix=".txt"
> timestamp="true" />
> value="15" />
>
> override="false" />
> type="javax.mail.Session" />
>
>
> mail.smtp.host
> localhost
>
>
>
>
> crossContext="true">
> prefix="standalone_DBTest_log." suffix=".txt"
> timestamp="true" />
> type="javax.sql.DataSource"
> driverClassName="com.mysql.jdbc.Driver" />
>
>
>
> factory
> org.apache.commons.dbcp.BasicDataSourceFactory
>
>
>
>
> factory
> com.mysql.jdbc.jdbc2.optional.
> MysqlConnectionPoolDataSource
>
>
>
>
> maxActive
> 100
>
>
>
>
> maxIdle
> 30
>
>
>
>
> maxWait
> 10000
>
>
>
>
> username
> javauser
>
>
>
>
> password
> javadude
>
>
>
>
> driverClassName
> com.mysql.jdbc.Driver
>
>
>
>
> url
> jdbc:mysql://localhost:3306
> /javatest?autoReconnect=true
>
>
>
>
> removeAbandoned
> true
>
>
>
>
> removeAbandonedTimeout
> 60
>
>
>
>
> logAbandoned
> true
>
>
>
>
>
>
>
>
> prefix="tomcat_apache_service." suffix=".txt"
> timestamp="true"/>
> port="8008" minProcessors="5" maxProcessors="75"
> enableLookups="true" appBase="webapps" acceptCount="10"
> debug="0" />
> name="Apache" localHost="127.0.0.1" debug="5">
> prefix="tomcatapacheEngine." suffix=".txt" timestamp="true"/>
>
> unpackWARs="true">
> directory="logs" prefix="tomcatapacheHost_log."
> suffix=".txt" timestamp="true" />
>
> reloadable="true" crossContext="true" useNaming="false">
> prefix="tomcatapache_DBTest_log." suffix=".txt"
> timestamp="true" />
> type="javax.sql.DataSource"
> driverClassName="com.mysql.jdbc.Driver"
> username="javauser" password="javadude"
> url="jdbc:mysql://localhost:3306
> /javatest?autoReconnect=true"
> factory="org.apache.commons.dbcp.
> BasicDataSourceFactory"
> maxActive="100"
> maxIdle="30"
> validationQuery="SELECT 1"
> testOnBorrow="true"
> testWhileIdle="true"
> timeBetweenEvictionRunsMillis="10000"
> minEvictableIdletime="60000"
> maxWait="10000"
> removeAbandoned="true"
> removeAbandonedTimeout="60"
> logAbandoned="true" />
>
> - privileged="true">
> prefix="apachetomcat_manager_log." suffix=".txt"
> timestamp="true" />
>
> reloadable="true" crossContext="true">
> prefix="apachetomcat_examples_log." suffix=".txt"
> timestamp="true" />
> value="15" />
>
> override="false" />
> type="javax.mail.Session" />
>
>
>
> mail.smtp.host
> localhost
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: jdbc driver
Posted by andy gordon <ef...@yahoo.com>.
is the MySQL Connector Jar file in the $CATALINA_HOME/common/lib directory?
Kito Holliday <ho...@phys.psu.edu> wrote:Attempting to use connector-java-3.3.10 with tomcat 4.0 and mysql and
servlets. The Java code:
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)lookup("jdbc/TestDB");
throws the exception:
Exception creating DataSource: org.hsql.jdbcDriver
The problem is that my .xml files never mentions the hsql jdbcDriver.
Obviously tomcat is ignoring my
Specifically, I have a web.xml having:
**************
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
DB Connection
jdbc/TestDB
javax.sql.DataSource
Container
***************
and a server.xml having
*****************Sorry for the long server.xml**********
port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443" acceptCount="10"
debug="0" connectionTimeout="60000" />
prefix="standaloneEngine_log." suffix=".txt"
timestamp="true"/>
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" />
directory="logs" prefix="standaloneHost_log." suffix=".txt"
timestamp="true" />
privileged="true">
prefix="standalone_manager_log." suffix=".txt"
timestamp="true" />
reloadable="true" crossContext="true">
prefix="standalone_examples_log." suffix=".txt"
timestamp="true" />
value="15" />
override="false" />
type="javax.mail.Session" />
mail.smtp.host
localhost
crossContext="true">
prefix="standalone_DBTest_log." suffix=".txt"
timestamp="true" />
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver" />
factory
org.apache.commons.dbcp.BasicDataSourceFactory
factory
com.mysql.jdbc.jdbc2.optional.
MysqlConnectionPoolDataSource
maxActive
100
maxIdle
30
maxWait
10000
username
javauser
password
javadude
driverClassName
com.mysql.jdbc.Driver
url
jdbc:mysql://localhost:3306
/javatest?autoReconnect=true
removeAbandoned
true
removeAbandonedTimeout
60
logAbandoned
true
prefix="tomcat_apache_service." suffix=".txt"
timestamp="true"/>
port="8008" minProcessors="5" maxProcessors="75"
enableLookups="true" appBase="webapps" acceptCount="10"
debug="0" />
name="Apache" localHost="127.0.0.1" debug="5">
prefix="tomcatapacheEngine." suffix=".txt" timestamp="true"/>
unpackWARs="true">
directory="logs" prefix="tomcatapacheHost_log."
suffix=".txt" timestamp="true" />
reloadable="true" crossContext="true" useNaming="false">
prefix="tomcatapache_DBTest_log." suffix=".txt"
timestamp="true" />
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
username="javauser" password="javadude"
url="jdbc:mysql://localhost:3306
/javatest?autoReconnect=true"
factory="org.apache.commons.dbcp.
BasicDataSourceFactory"
maxActive="100"
maxIdle="30"
validationQuery="SELECT 1"
testOnBorrow="true"
testWhileIdle="true"
timeBetweenEvictionRunsMillis="10000"
minEvictableIdletime="60000"
maxWait="10000"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true" />
- privileged="true">
prefix="apachetomcat_manager_log." suffix=".txt"
timestamp="true" />
reloadable="true" crossContext="true">
prefix="apachetomcat_examples_log." suffix=".txt"
timestamp="true" />
value="15" />
override="false" />
type="javax.mail.Session" />
mail.smtp.host
localhost
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com