Yeah, I just tried that and still no go.  Still getting:

javax.servlet.ServletException: Unable to get connection, DataSource
invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null', cause: No suitable driver"

-----Original Message-----
From: Jan Behrens [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 01, 2004 1:04 AM
To: 'Tomcat Users List'
Subject: RE: Tomcat -> MySQL = No suitable driver ERROR


David is right, 

you will need to rename {Catalina_Home}/webapps/DBTest/WEB-INF/DBTest.xml to
{Catalina_Home}/webapps/DBTest/WEB-INF/web.xml and hopefully all will be up
and running.

Jan

-----Original Message-----
From: David Smith [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 01, 2004 3:56 AM
To: Tomcat Users List
Subject: Re: Tomcat -> MySQL = No suitable driver ERROR


Ok.  I think I'm seeing your trouble.  The stuff you have in 
WEB-INF/DB-Test.xml should be in web.xml instead.  In mine, the 
<resource-ref>...</resource-ref> stuff is at the end of the file just 
before the closing </web-app> tag.  In tomcat versions 3 and 4, the 
order of elements in web.xml was important.  I believe that requirement 
has been lifted in tomcat 5.

--David

Try that and see what happens.

--David

Briggs, Patrick wrote:

>I'm using an example someone else on this list gave me.
>
>So inside of {CATALINA_HOME}/conf/Catalina/localhost/DBTest.xml
>
><?xml version='1.0' encoding='utf-8'?>
><Context debug="5" displayName="DBtest" docBase="DBTest" path="/DBtest" 
>reloadable="true" workDir="work\Catalina\localhost\DBTest">
>
>  <Resource auth="Container" name="jdbc/DBTest" 
>type="javax.sql.DataSource"/>
>  <ResourceParams name="jdbc/DBTest">
>    <parameter>
>      <name>url</name>
>       <value>jdbc:mysql://cir-ops:3306/javatest?autoReconnect=true</value>
>    </parameter>
>    <parameter>
>      <name>maxIdle</name>
>      <value>15</value>
>    </parameter>
>    <parameter>
>      <name>maxActive</name>
>      <value>50</value>
>    </parameter>
>    <parameter>
>      <name>driverClassName</name>
>      <value>com.mysql.jdbc.Driver</value>
>    </parameter>
>    <parameter>
>      <name>maxWait</name>
>      <value>10000</value>
>    </parameter>
>    <parameter>
>      <name>removeAbandoned</name>
>      <value>true</value>
>    </parameter>
>    <parameter>
>      <name>username</name>
>      <value>javauser</value>
>    </parameter>
>    <parameter>
>      <name>factory</name>
>      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>    </parameter>
>    <parameter>
>      <name>removeAbandonedTimeout</name>
>      <value>60</value>
>    </parameter>
>    <parameter>
>      <name>password</name>
>      <value>javadude</value>
>    </parameter>
>  </ResourceParams>
></Context>
>
>The contents of {Catalina_Home}/webapps/DBTest/WEB-INF/DBTest.xml
>
><?xml version="1.0" encoding="UTF-8"?>
><!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 xmlns="http://java.sun.com/xml/ns/j2ee";
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
>    version="2.4">
>  <description>MySQL Test App</description>
>  <resource-ref>
>      <description>DB Connection</description>
>      <res-ref-name>jdbc/DBTest</res-ref-name>
>      <res-type>javax.sql.DataSource</res-type>
>      <res-auth>Container</res-auth>
>  </resource-ref>
> 
>  </web-app>
>
>Contents of {Catalina_Home/webapps/DBTest/test.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/DBTest">
>select id, foo, bar from testdata
></sql:query>
>
><html>
>  <head>
>    <title>DB Test</title>
>  </head>
>  <body>
>
>  <h2>Results</h2>
>  
><c:forEach var="row" items="${rs.rows}">
>    Foo ${row.foo}<br/>
>    Bar ${row.bar}<br/>
></c:forEach>
>
>  </body>
></html>
>
>The error message displayed on the web-broser for the URL: 
>http://localhost:8080/DBTest/test.jsp
>
>javax.servlet.ServletException: Unable to get connection, DataSource
>invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create 
>JDBC driver of class '' for connect URL 'null', cause: No suitable 
>driver"
>       
>org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageCon
>textI
>mpl.java:825)
>       
>org.apache.jasper.runtime.PageContextImpl.handlePageException(PageConte
>xtImp
>l.java:758)
>       org.apache.jsp.test_jsp._jspService(test_jsp.java:81)
>       org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>       
>org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.j
>ava:2
>98)
>       
>org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
>       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>
>
>root cause
>
>javax.servlet.jsp.JspException: Unable to get connection, DataSource
>invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create 
>JDBC driver of class '' for connect URL 'null', cause: No suitable 
>driver"
>       
>org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnectio
>n(Unk
>nown Source)
>       
>org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(U
>nknow
>n Source)
>       org.apache.jsp.test_jsp._jspx_meth_sql_query_0(test_jsp.java:100)
>       org.apache.jsp.test_jsp._jspService(test_jsp.java:58)
>       org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>       
>org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.j
>ava:2
>98)
>       
>org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
>       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>
>
>-----Original Message-----
>From: David Smith [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, June 30, 2004 1:33 PM
>To: Tomcat Users List
>Subject: Re: Tomcat -> MySQL = No suitable driver ERROR
>
>
>I've set this up I don't know how many times and only ever had problems
>when I've mispelled the JNDI name I gave it somewhere in the 4 places it 
>was specified.  Others have had issue with the order of parameters in 
>the ResourceParams block.  To be on the safe side, follow the order of 
>parameters given in the jndi-datasource-howto.html page you were 
>following.  That's the same page I followed when I did this for the 
>first time.
>
>I take it you've:
>
>1)  defined a <Resource/> and <ResouceParams/> block in your
>{context}.xml file that's stored in the 
>{TOMCAT_HOME}/conf/Catalina/localhost folder.  Both <Resource/> and 
><ResourceParams>...</ResourceParams> sections have the same JNDI name in 
>their name attributes.  I'd recommend all lower case since case is 
>important in java.
>
>2) Placed a <resource-ref>...</resource-ref> in your WEB-INF/web.xml
>file with the <res-ref-name>...</res-ref-name> tag specifying the same 
>JNDI name specified in the {context}.xml file above.  I keep harping on 
>the same JNDI name because this is where I've been messed up before.
>
>3) Did a lookup for java:comp/env/{your JNDI name here} in your java 
>code.
>
>4) Restarted the tomcat service after putting the mysql jar file in
>common/lib so the tomcat classloaders can see it.
>
>Can you post what you do have in {context}.xml and web.xml and just 
>omit
>the username and password for the database or put in bogus ones for the 
>purposes of posting to the list?  An excerpt of your java code where you 
>attempt to access the db would be good as well.
>
>--David
>
>Briggs, Patrick wrote:
>
>  
>
>>Ok, I have it in the common/lib directory, but that didn't make a 
>>difference.  You'd think there would be a lot easier way to setup 
>>stuff
>>    
>>
>like
>  
>
>>this.  Editing XML files is pretty tricky business.
>>
>>-----Original Message-----
>>From: David Smith [mailto:[EMAIL PROTECTED]
>>Sent: Wednesday, June 30, 2004 12:19 PM
>>To: Tomcat Users List
>>Subject: Re: Tomcat -> MySQL = No suitable driver ERROR
>>
>>
>>Wrong place for mysql jar file.  It should be in
>>{TOMCAT_HOME}/common/lib right along side the DBCP jar file.
>>
>>--David
>>
>>Briggs, Patrick wrote:
>>
>> 
>>
>>    
>>
>>>If the webapps.xml file is supposed to be located in 
>>>Catalina\localhost,
>>>   
>>>
>>>      
>>>
>>the
>> 
>>
>>    
>>
>>>apache's own website documentation JDBC-HOWTO needs to be updated to
>>>   
>>>
>>>      
>>>
>>reflect
>> 
>>
>>    
>>
>>>that new situation.  I'm surprised they haven't updated it because 
>>>I'm
>>>      
>>>
>sure
>  
>
>>>a lot of other people are going to be having the same problems I am.
>>>
>>>I have made all of the changes you have suggest.  the mysql.jar file 
>>>has been deleted everywhere except for {CATALINA_HOME}/shared/lib 
>>>where I have now placed it.
>>>
>>>I have created a file called DBTest.xml over in 
>>>/conf/Catalina/localhost/DBTest.xml
>>>
>>>I used your template for the XML find changing it where it needs 
>>>changes
>>>   
>>>
>>>      
>>>
>>for
>> 
>>
>>    
>>
>>>URL and username/password.
>>>
>>>Still getting the same error message :(
>>>So now what could it be?
>>>
>>>-----Original Message-----
>>>From: Jan Behrens [mailto:[EMAIL PROTECTED]
>>>Sent: Wednesday, June 30, 2004 1:58 AM
>>>To: 'Tomcat Users List'
>>>Subject: RE: Tomcat -> MySQL = No suitable driver ERROR
>>>
>>>
>>>Hi Patrick,
>>>
>>>the problem might be that in Tomcat 5.x the storage of the context 
>>>related configuration changed from server.xml to a sepparate file for 
>>>each webapp. This file should be stored under 
>>>{Catalina_Home}\conf\Catalina\{domain-name}\myWebAppName.xml where 
>>>Catalina_Home points to your Tomcat installation dir and domain_name
>>>   
>>>
>>>      
>>>
>>usually
>> 
>>
>>    
>>
>>>would be localhost in a dev-environment.
>>>
>>>If you have a webapp called myWebApp and want to setup a datastore 
>>>via
>>>      
>>>
>jndi
>  
>
>>>for same to use in Tomcat 5 you could use the following as a basis 
>>>for a myWebApp.xml file stored under
>>>{Catalina_Home}\conf\Catalina\{domain-name}\myWebAppName.xml:
>>>
>>>
>>><?xml version='1.0' encoding='utf-8'?>
>>><Context debug="5" displayName="myWebApp" docBase="myWebApp " 
>>>path="/myWebApp" reloadable="true" 
>>>workDir="work\Catalina\localhost\myWebApp">
>>>
>>><Resource auth="Container" name="jdbc/myWebApp" 
>>>type="javax.sql.DataSource"/> <ResourceParams name="jdbc/myWebApp">
>>>  <parameter>
>>>    <name>url</name>
>>>
>>><value>jdbc:mysql://NAME_OR_IP_OF_MYSQL_SERVER:3306/NAME_OF_DATABASE?
>>>autoR
>>>      
>>>
>e
>  
>
>>>   
>>>
>>>      
>>>
>>c
>> 
>>
>>    
>>
>>>onnect=true</value>
>>>  </parameter>
>>>  <parameter>
>>>    <name>maxIdle</name>
>>>    <value>15</value>
>>>  </parameter>
>>>  <parameter>
>>>    <name>maxActive</name>
>>>    <value>50</value>
>>>  </parameter>
>>>  <parameter>
>>>    <name>driverClassName</name>
>>>    <value>com.mysql.jdbc.Driver</value>
>>>  </parameter>
>>>  <parameter>
>>>    <name>maxWait</name>
>>>    <value>10000</value>
>>>  </parameter>
>>>  <parameter>
>>>    <name>removeAbandoned</name>
>>>    <value>true</value>
>>>  </parameter>
>>>  <parameter>
>>>    <name>username</name>
>>>    <value>USERNAME</value>
>>>  </parameter>
>>>  <parameter>
>>>    <name>factory</name>
>>>    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>>>  </parameter>
>>>  <parameter>
>>>    <name>removeAbandonedTimeout</name>
>>>    <value>60</value>
>>>  </parameter>
>>>  <parameter>
>>>    <name>password</name>
>>>    <value>PASSWORD</value>
>>>  </parameter>
>>></ResourceParams>
>>></Context>
>>>
>>>The MySQL driver does have to go under {Catalina_Home}\shared\lib! 
>>>Delete any other copies you might have placed in your WEB-INF\lib or 
>>>anywhere
>>>   
>>>
>>>      
>>>
>>else.
>> 
>>
>>    
>>
>>>You should also remove the <context>....</context> you inserted in 
>>>server.xml as this should all go in the myWebApp.xml file.
>>>
>>>If you ever deploy your webapp you then only have to copy your
>>>      
>>>
>myWebApp.xml
>  
>
>>>to the Manifest dir in your webapp root dir before creating the 
>>>war-file
>>>   
>>>
>>>      
>>>
>>and
>> 
>>
>>    
>>
>>>Tomcat will automatically create the correct context for your webapp.
>>>
>>>HTH, Jan
>>>
>>>
>>>This e-mail message, including any attachments, is for the sole use 
>>>of the intended recipient(s) and may contain confidential or 
>>>privileged information.  Any unauthorized review, use, disclosure or 
>>>distribution is prohibited.  If you are not the intended recipient, 
>>>please contact the sender by reply e-mail and destroy the message.
>>>
>>>
>>>
>>>   
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>This e-mail message, including any attachments, is for the sole use of 
>>the intended recipient(s) and may contain confidential or privileged 
>>information.  Any unauthorized review, use, disclosure or distribution 
>>is prohibited.  If you are not the intended recipient, please contact 
>>the sender by reply e-mail and destroy the message.
>>
>> 
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>This e-mail message, including any attachments, is for the sole use of 
>the intended recipient(s) and may contain confidential or privileged 
>information.  Any unauthorized review, use, disclosure or distribution 
>is prohibited.  If you are not the intended recipient, please contact 
>the sender by reply e-mail and destroy the message.
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential or privileged
information.  Any unauthorized review, use, disclosure or distribution is
prohibited.  If you are not the intended recipient, please contact the
sender by reply e-mail and destroy the message.

Reply via email to