You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Eric Yin <y_...@encs.concordia.ca> on 2006/11/03 18:24:58 UTC
Cannot create JDBC driver of class '' for connect URL 'null'"
Hi,
I'm using tomcat5.5.2 and mysql5.0.27 and Connector/J 5.0.
i'm doing the same thing as
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
and i got this error.
i'm using fedora 5 and i download "Linux (non RPM package) downloads
/linux (x86)" of mysql and install it accoding to the insturction. I
created a databse P6120 and table test2 by using user 'eric' and
passwod 'ericyin1'.
I add the following to server.xml:
<Context path="/DBTest" docBase="DBTest"
debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="eric" password="ericyin1"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/p6120?autoReconnect=true"/>
</Context>
I add the following to web.xml:
<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>
I add the following to the index.jsp:
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query var="rs" dataSource="jdbc/TestDB">
select id, name, studentid from test2
</sql:query>
<c:forEach var="row" items="${rs.rows}">
name ${row.name}<br/>
studentid ${row.studentid}<br/>
</c:forEach>
thanks,
Eric.
---------------------------------------------------------------------
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
Re: Cannot create JDBC driver of class '' for connect URL 'null'"
Posted by Martin Gainty <mg...@hotmail.com>.
eric-
the name of your DB in the URL appears incorrect
instead of
url="jdbc:mysql://localhost:3306/p6120?autoReconnect=true"
use
url="jdbc:mysql://localhost:3306/P6120?autoReconnect=true"
anyone else?
M-
This e-mail communication and any attachments may contain confidential and privileged information for the use of the
designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received
this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its
contents
----- Original Message -----
From: "Eric Yin" <y_...@encs.concordia.ca>
To: <us...@tomcat.apache.org>
Sent: Friday, November 03, 2006 4:12 PM
Subject: Re: Cannot create JDBC driver of class '' for connect URL 'null'"
> Quoting Eric Yin <y_...@encs.concordia.ca>:
>
>> Hi,
>>
>> I'm using tomcat5.5.2 and mysql5.0.27 and Connector/J 5.0.
>> i'm doing the same thing as
>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>> and i got this error.
>>
>> i'm using fedora 5 and i download "Linux (non RPM package) downloads
>> /linux (x86)" of mysql and install it accoding to the insturction. I
>> created a databse P6120 and table test2 by using user 'eric' and
>> passwod 'ericyin1'.
>>
>> I add the following to server.xml:
>> <Context path="/DBTest" docBase="DBTest"
>> debug="5" reloadable="true" crossContext="true">
>> <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
>> maxActive="100" maxIdle="30" maxWait="10000"
>> username="eric" password="ericyin1"
>> driverClassName="com.mysql.jdbc.Driver"
>> url="jdbc:mysql://localhost:3306/p6120?autoReconnect=true"/>
>>
>> </Context>
>>
>> I add the following to web.xml:
>> <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>
>>
>> I add the following to the index.jsp:
>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>> <sql:query var="rs" dataSource="jdbc/TestDB">
>> select id, name, studentid from test2
>> </sql:query>
>>
>>
>> <c:forEach var="row" items="${rs.rows}">
>> name ${row.name}<br/>
>> studentid ${row.studentid}<br/>
>> </c:forEach>
>>
>> thanks,
>>
>> Eric.
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>
>
>
>
> ---------------------------------------------------------------------
> 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
>
>
Re: Cannot create JDBC driver of class '' for connect URL 'null'"
Posted by Eric Yin <y_...@encs.concordia.ca>.
Quoting Eric Yin <y_...@encs.concordia.ca>:
> Hi,
>
> I'm using tomcat5.5.2 and mysql5.0.27 and Connector/J 5.0.
> i'm doing the same thing as
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> and i got this error.
>
> i'm using fedora 5 and i download "Linux (non RPM package) downloads
> /linux (x86)" of mysql and install it accoding to the insturction. I
> created a databse P6120 and table test2 by using user 'eric' and
> passwod 'ericyin1'.
>
> I add the following to server.xml:
> <Context path="/DBTest" docBase="DBTest"
> debug="5" reloadable="true" crossContext="true">
> <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
> maxActive="100" maxIdle="30" maxWait="10000"
> username="eric" password="ericyin1"
> driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/p6120?autoReconnect=true"/>
>
> </Context>
>
> I add the following to web.xml:
> <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>
>
> I add the following to the index.jsp:
> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> <sql:query var="rs" dataSource="jdbc/TestDB">
> select id, name, studentid from test2
> </sql:query>
>
>
> <c:forEach var="row" items="${rs.rows}">
> name ${row.name}<br/>
> studentid ${row.studentid}<br/>
> </c:forEach>
>
> thanks,
>
> Eric.
>
>
>
> ---------------------------------------------------------------------
> 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
>
---------------------------------------------------------------------
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
Re: Cannot create JDBC driver of class '' for connect URL 'null'"
Posted by Eric Yin <y_...@encs.concordia.ca>.
Hi Guys,
I just found out the reason. My index.jsp in the the Root directory,
however, the path of the sever.xml/context is "/DBTest".
thanks for all the help.
Eric.
Quoting Eric Yin <y_...@encs.concordia.ca>:
> Hi Chris,
>
> Thanks for the help.
>
> After I move the Connector/J 5.0 to the Tomcat's server-wise
> common/lib directory and remove the autoReconnect=true, i still get
> the same error.
>
> thanks,
>
> Eric.
>
>
> Quoting Christopher Schultz <ch...@christopherschultz.net>:
>
>> Eric,
>>
>> Eric Yin wrote:
>>> Hi,
>>>
>>> I'm using tomcat5.5.2 and mysql5.0.27 and Connector/J 5.0.
>>> i'm doing the same thing as
>>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>>> and i got this error.
>>
>> Where did you put mysql-connector-*.jar? I suspect that you have it in
>> your webapp's lib directory, but you need to have it in Tomcat's
>> server-wise common/lib directory.
>>
>> Another note:
>>
>>> url="jdbc:mysql://localhost:3306/p6120?autoReconnect=true"/>
>>
>> Since you are using a DataSource which defaults to the Jakarta Commons
>> DBCP pool, you should remove the "autoReconnect=true" from your URL;
>> re-connection is handled by the DPCP library, so you /should be/ able to
>> safely remove this parameter. This feature is documented to be
>> undesirable as seen here:
>>
>> http://dev.mysql.com/doc/refman/4.1/en/connector-j-reference-configuration-properties.html
>>
>> For the lazy: (emphasis added by me)
>>
>> "Should the driver try to re-establish stale and/or dead connections? If
>> enabled the driver will throw an exception for a queries issued on a
>> stale or dead connection, which belong to the current transaction, but
>> will attempt reconnect before the next query issued on the connection in
>> a new transaction. *The use of this feature is not recommended, because
>> it has side effects related to session state and data consistency when
>> applications don'thandle SQLExceptions properly, and is only designed to
>> be used when you are unable to configure your application to handle
>> SQLExceptions resulting from dead andstale connections properly*.
>> Alternatively, investigate setting the MySQL server variable
>> "wait_timeout"to some high value rather than the default of 8 hours."
>>
>> -chris
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> 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
>
---------------------------------------------------------------------
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
Re: Cannot create JDBC driver of class '' for connect URL 'null'"
Posted by Eric Yin <y_...@encs.concordia.ca>.
Hi Chris,
Thanks for the help.
After I move the Connector/J 5.0 to the Tomcat's server-wise common/lib
directory and remove the autoReconnect=true, i still get the same error.
thanks,
Eric.
Quoting Christopher Schultz <ch...@christopherschultz.net>:
> Eric,
>
> Eric Yin wrote:
>> Hi,
>>
>> I'm using tomcat5.5.2 and mysql5.0.27 and Connector/J 5.0.
>> i'm doing the same thing as
>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>> and i got this error.
>
> Where did you put mysql-connector-*.jar? I suspect that you have it in
> your webapp's lib directory, but you need to have it in Tomcat's
> server-wise common/lib directory.
>
> Another note:
>
>> url="jdbc:mysql://localhost:3306/p6120?autoReconnect=true"/>
>
> Since you are using a DataSource which defaults to the Jakarta Commons
> DBCP pool, you should remove the "autoReconnect=true" from your URL;
> re-connection is handled by the DPCP library, so you /should be/ able to
> safely remove this parameter. This feature is documented to be
> undesirable as seen here:
>
> http://dev.mysql.com/doc/refman/4.1/en/connector-j-reference-configuration-properties.html
>
> For the lazy: (emphasis added by me)
>
> "Should the driver try to re-establish stale and/or dead connections? If
> enabled the driver will throw an exception for a queries issued on a
> stale or dead connection, which belong to the current transaction, but
> will attempt reconnect before the next query issued on the connection in
> a new transaction. *The use of this feature is not recommended, because
> it has side effects related to session state and data consistency when
> applications don'thandle SQLExceptions properly, and is only designed to
> be used when you are unable to configure your application to handle
> SQLExceptions resulting from dead andstale connections properly*.
> Alternatively, investigate setting the MySQL server variable
> "wait_timeout"to some high value rather than the default of 8 hours."
>
> -chris
>
>
---------------------------------------------------------------------
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
Re: Cannot create JDBC driver of class '' for connect URL 'null'"
Posted by David Smith <dn...@cornell.edu>.
I'll go further and say mysql discourages the use of autoReconnect. See:
http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html
the section titled "High Availability and Clustering. "
--David
Christopher Schultz wrote:
> Eric,
>
> Eric Yin wrote:
>
>> Hi,
>>
>> I'm using tomcat5.5.2 and mysql5.0.27 and Connector/J 5.0.
>> i'm doing the same thing as
>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>> and i got this error.
>>
>
> Where did you put mysql-connector-*.jar? I suspect that you have it in
> your webapp's lib directory, but you need to have it in Tomcat's
> server-wise common/lib directory.
>
> Another note:
>
>
>> url="jdbc:mysql://localhost:3306/p6120?autoReconnect=true"/>
>>
>
> Since you are using a DataSource which defaults to the Jakarta Commons
> DBCP pool, you should remove the "autoReconnect=true" from your URL;
> re-connection is handled by the DPCP library, so you /should be/ able to
> safely remove this parameter. This feature is documented to be
> undesirable as seen here:
>
> http://dev.mysql.com/doc/refman/4.1/en/connector-j-reference-configuration-properties.html
>
> For the lazy: (emphasis added by me)
>
> "Should the driver try to re-establish stale and/or dead connections? If
> enabled the driver will throw an exception for a queries issued on a
> stale or dead connection, which belong to the current transaction, but
> will attempt reconnect before the next query issued on the connection in
> a new transaction. *The use of this feature is not recommended, because
> it has side effects related to session state and data consistency when
> applications don'thandle SQLExceptions properly, and is only designed to
> be used when you are unable to configure your application to handle
> SQLExceptions resulting from dead andstale connections properly*.
> Alternatively, investigate setting the MySQL server variable
> "wait_timeout"to some high value rather than the default of 8 hours."
>
> -chris
>
>
---------------------------------------------------------------------
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
Re: Cannot create JDBC driver of class '' for connect URL 'null'"
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Eric,
Eric Yin wrote:
> Hi,
>
> I'm using tomcat5.5.2 and mysql5.0.27 and Connector/J 5.0.
> i'm doing the same thing as
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> and i got this error.
Where did you put mysql-connector-*.jar? I suspect that you have it in
your webapp's lib directory, but you need to have it in Tomcat's
server-wise common/lib directory.
Another note:
> url="jdbc:mysql://localhost:3306/p6120?autoReconnect=true"/>
Since you are using a DataSource which defaults to the Jakarta Commons
DBCP pool, you should remove the "autoReconnect=true" from your URL;
re-connection is handled by the DPCP library, so you /should be/ able to
safely remove this parameter. This feature is documented to be
undesirable as seen here:
http://dev.mysql.com/doc/refman/4.1/en/connector-j-reference-configuration-properties.html
For the lazy: (emphasis added by me)
"Should the driver try to re-establish stale and/or dead connections? If
enabled the driver will throw an exception for a queries issued on a
stale or dead connection, which belong to the current transaction, but
will attempt reconnect before the next query issued on the connection in
a new transaction. *The use of this feature is not recommended, because
it has side effects related to session state and data consistency when
applications don'thandle SQLExceptions properly, and is only designed to
be used when you are unable to configure your application to handle
SQLExceptions resulting from dead andstale connections properly*.
Alternatively, investigate setting the MySQL server variable
"wait_timeout"to some high value rather than the default of 8 hours."
-chris