RE: Tomcat - MySQL = No suitable driver ERROR
yes patrick, i guess that is what david and i want so your dbtest works. allthough the posted contents of web.xml lack a doctype or schema definition (see hassans post). now, have you tried this? cheers, jan -Original Message- From: Briggs, Patrick [mailto:[EMAIL PROTECTED] Sent: Thursday, July 01, 2004 7:59 PM To: 'Tomcat Users List' Cc: '[EMAIL PROTECTED]' Subject: RE: Tomcat - MySQL = No suitable driver ERROR Ok, the contents of {TOMCAT_HOME}/conf/Catalina/localhost/DBTest.xml is: 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 nameurl/name valuejdbc:mysql://cir-ops:3306/javatest?autoReconnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuejavadude/value /parameter /ResourceParams /Context Contents of {TOMCAT_HOME}/webapps/DBTest/WEB-INF/web.xml is: web-app descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/DBTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app Is this what you wanted? -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Thursday, July 01, 2004 10:25 AM To: Tomcat Users List Subject: Re: Tomcat - MySQL = No suitable driver ERROR Hold on a minute. I think we have a communication problem here. I wasn't recommending you do that. Slow down, take a breath and read my posts VERY carefully. We are looking at two different files here. DBTest.xml as a file containing the Context.../Context stuff should be in {TOMCAT_HOME}/conf/Catalina/localhost. Leave that alone. I was recommending you take the resource-ref.../resource-ref stuff you put in {TOMCAT_HOME}/webapps/DBTest/WEB-INF/DBTest.xml and put that in {TOMCAT_HOME}/webapps/DBTest/WEB-INF/web.xml. Both files are needed with their respective parts. The context definition needs to have the Resource/ and ResourceParams.../ResourceParams sections to define a connection pool and make it available in tomcat's JNDI name space. web.xml needs the resource-ref.../resource-ref stuff to make the connection pool avialable to your application. --David Briggs, Patrick wrote: Ok, I tried as you suggested, I deleted DBTest.xml out of the conf/Catalina/localhost directory and placed it inside my web.xml for the webapp itself. I rebooted my machine, restarted Tomcat, same error. Still nothing. Here is what my web.xml looks like now: ?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 descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/DBTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref 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 nameurl/name valuejdbc:mysql://cir-ops:3306/javatest?autoReconnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter
RE: Tomcat - MySQL = No suitable driver ERROR
David had me do this following proceedure and that seemed to work, but my JSP does not return any data so far. The database finally connected though. When I view this JSP page, all it prints is: ${row.foo} ${row.bar} instead of the data that should be contained inside those variables. 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 * from testdata /sql:query html head titleDB Test/title /head body h2Results/h2 c:forEach var=row items=${rs.rows} c:out value=${row.foo}/ c:out value=${row.bar}/ /c:forEach /body /html From David: Here's first what should be in {TOMCAT_HOME}/conf/Catalina/localhost/DBTest.xml: Context path=/DBTest docBase=DBTest debug=0 privileged=false !-- Loggers, valves, other stuff here -- Resource name=jdbc/DbTest auth=container type=javax.sql.DataSource/ ResourceParams name=jdbc/DbTest parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value30/value /parameter parameter namemaxWait/name value10/value /parameter !-- Customize with your database username -- parameter nameusername/name valueDBTestUser/value /parameter !-- Customize with your database password here -- parameter namepassword/name value*/value parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- Customize with your mysql url -- parameter nameurl/name valuejdbc:mysql://localhost:3306/DBTest?autoReconnect=true/value /parameter /ResourceParams /Context - Ok, now what should be in {TOMCAT_HOME}/webapps/DBTest/WEB-INF/web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd; web-app display-nameDbTest Application/display-name !-- All your servlet definitions, mappings, welcome file specs, taglibs, etc, ... are placed here. -- !--+ resource-ref here to make the database pool available in this application +-- resource-ref descriptionDBTest Database/description res-ref-namejdbc/DbTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app - This exact formula has worked for me in I can't even count how many apps I've setup. --David -Original Message- From: Jan Behrens [mailto:[EMAIL PROTECTED] Sent: Friday, July 02, 2004 1:50 AM To: 'Tomcat Users List' Subject: RE: Tomcat - MySQL = No suitable driver ERROR yes patrick, i guess that is what david and i want so your dbtest works. allthough the posted contents of web.xml lack a doctype or schema definition (see hassans post). now, have you tried this? cheers, 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.
RE: Tomcat - MySQL = No suitable driver ERROR
Good to hear that it is finally working. I am sorry, but I have never used any sql tag-lib so I can't really help you with this problem. I would suggest though, to google for a simple example - if that doesn't help open a new thread here in the list and ask specifically for help with your new problem. I am sure that someone will know... Jan -Original Message- From: Briggs, Patrick [mailto:[EMAIL PROTECTED] Sent: Friday, July 02, 2004 6:36 PM To: 'Tomcat Users List' Subject: RE: Tomcat - MySQL = No suitable driver ERROR David had me do this following proceedure and that seemed to work, but my JSP does not return any data so far. The database finally connected though. When I view this JSP page, all it prints is: ${row.foo} ${row.bar} instead of the data that should be contained inside those variables. 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 * from testdata /sql:query html head titleDB Test/title /head body h2Results/h2 c:forEach var=row items=${rs.rows} c:out value=${row.foo}/ c:out value=${row.bar}/ /c:forEach /body /html From David: Here's first what should be in {TOMCAT_HOME}/conf/Catalina/localhost/DBTest.xml: Context path=/DBTest docBase=DBTest debug=0 privileged=false !-- Loggers, valves, other stuff here -- Resource name=jdbc/DbTest auth=container type=javax.sql.DataSource/ ResourceParams name=jdbc/DbTest parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value30/value /parameter parameter namemaxWait/name value10/value /parameter !-- Customize with your database username -- parameter nameusername/name valueDBTestUser/value /parameter !-- Customize with your database password here -- parameter namepassword/name value*/value parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- Customize with your mysql url -- parameter nameurl/name valuejdbc:mysql://localhost:3306/DBTest?autoReconnect=true/value /parameter /ResourceParams /Context - Ok, now what should be in {TOMCAT_HOME}/webapps/DBTest/WEB-INF/web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd; web-app display-nameDbTest Application/display-name !-- All your servlet definitions, mappings, welcome file specs, taglibs, etc, ... are placed here. -- !--+ resource-ref here to make the database pool available in this application +-- resource-ref descriptionDBTest Database/description res-ref-namejdbc/DbTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app - This exact formula has worked for me in I can't even count how many apps I've setup. --David -Original Message- From: Jan Behrens [mailto:[EMAIL PROTECTED] Sent: Friday, July 02, 2004 1:50 AM To: 'Tomcat Users List' Subject: RE: Tomcat - MySQL = No suitable driver ERROR yes patrick, i guess that is what david and i want so your dbtest works. allthough the posted contents of web.xml lack a doctype or schema definition (see hassans post). now, have you tried this? cheers, 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]
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 nameurl/name valuejdbc:mysql://cir-ops:3306/javatest?autoReconnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuejavadude/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 descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/DBTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/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 titleDB Test/title /head body h2Results/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
RE: Tomcat - MySQL = No suitable driver ERROR
Ok, I tried as you suggested, I deleted DBTest.xml out of the conf/Catalina/localhost directory and placed it inside my web.xml for the webapp itself. I rebooted my machine, restarted Tomcat, same error. Still nothing. Here is what my web.xml looks like now: ?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 descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/DBTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref 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 nameurl/name valuejdbc:mysql://cir-ops:3306/javatest?autoReconnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuejavadude/value /parameter /ResourceParams /Context /web-app -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 30, 2004 6:56 PM 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 nameurl/name valuejdbc:mysql://cir-ops:3306/javatest?autoReconnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuejavadude/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 descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/DBTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/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 titleDB Test/title /head body h2Results/h2 c:forEach var=row items=${rs.rows
RE: Tomcat - MySQL = No suitable driver ERROR
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 nameurl/name valuejdbc:mysql://cir-ops:3306/javatest?autoReconnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuejavadude/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 descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/DBTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/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 titleDB Test/title /head body h2Results/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
RE: Tomcat - MySQL = No suitable driver ERROR
I have seen this one too many times. It usually has to do with the naming lookup. I have had to keep playing with the form of the name until it worked. Robert S. Harper 801.265.8800 ex. 255 -Original Message- From: Briggs, Patrick [mailto:[EMAIL PROTECTED] Sent: Thursday, July 01, 2004 10:20 AM To: 'Tomcat Users List' Subject: RE: Tomcat - MySQL = No suitable driver ERROR 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- [snip] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat - MySQL = No suitable driver ERROR
Why does it have to be so difficult? Pretty soon I'll have to give up and go back to PHP. What I really want to do is try out Javaserver Faces. -Original Message- From: Robert Harper [mailto:[EMAIL PROTECTED] Sent: Thursday, July 01, 2004 9:38 AM To: 'Tomcat Users List' Subject: RE: Tomcat - MySQL = No suitable driver ERROR I have seen this one too many times. It usually has to do with the naming lookup. I have had to keep playing with the form of the name until it worked. Robert S. Harper 801.265.8800 ex. 255 -Original Message- From: Briggs, Patrick [mailto:[EMAIL PROTECTED] Sent: Thursday, July 01, 2004 10:20 AM To: 'Tomcat Users List' Subject: RE: Tomcat - MySQL = No suitable driver ERROR 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- [snip] - 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.
Re: Tomcat - MySQL = No suitable driver ERROR
Hold on a minute. I think we have a communication problem here. I wasn't recommending you do that. Slow down, take a breath and read my posts VERY carefully. We are looking at two different files here. DBTest.xml as a file containing the Context.../Context stuff should be in {TOMCAT_HOME}/conf/Catalina/localhost. Leave that alone. I was recommending you take the resource-ref.../resource-ref stuff you put in {TOMCAT_HOME}/webapps/DBTest/WEB-INF/DBTest.xml and put that in {TOMCAT_HOME}/webapps/DBTest/WEB-INF/web.xml. Both files are needed with their respective parts. The context definition needs to have the Resource/ and ResourceParams.../ResourceParams sections to define a connection pool and make it available in tomcat's JNDI name space. web.xml needs the resource-ref.../resource-ref stuff to make the connection pool avialable to your application. --David Briggs, Patrick wrote: Ok, I tried as you suggested, I deleted DBTest.xml out of the conf/Catalina/localhost directory and placed it inside my web.xml for the webapp itself. I rebooted my machine, restarted Tomcat, same error. Still nothing. Here is what my web.xml looks like now: ?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 descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/DBTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref 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 nameurl/name valuejdbc:mysql://cir-ops:3306/javatest?autoReconnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuejavadude/value /parameter /ResourceParams /Context /web-app -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 30, 2004 6:56 PM 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 nameurl/name valuejdbc:mysql://cir-ops:3306/javatest?autoReconnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuejavadude/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
Re: Tomcat - MySQL = No suitable driver ERROR
David Smith wrote: I was recommending you take the resource-ref.../resource-ref stuff you put in {TOMCAT_HOME}/webapps/DBTest/WEB-INF/DBTest.xml and put that in {TOMCAT_HOME}/webapps/DBTest/WEB-INF/web.xml. Yes, and in addition -- Here is what my web.xml looks like now: ?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 descriptionMySQL Test App/description ?! You've got a 2.3 DOCTYPE and a 2.4 schema reference in the same file, which is /seriously/ wrong. :-) You want one or the other. FWIW! -- Hassan Schroeder - [EMAIL PROTECTED] Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com dream. code. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat - MySQL = No suitable driver ERROR
Ok, the contents of {TOMCAT_HOME}/conf/Catalina/localhost/DBTest.xml is: 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 nameurl/name valuejdbc:mysql://cir-ops:3306/javatest?autoReconnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuejavadude/value /parameter /ResourceParams /Context Contents of {TOMCAT_HOME}/webapps/DBTest/WEB-INF/web.xml is: web-app descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/DBTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app Is this what you wanted? -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Thursday, July 01, 2004 10:25 AM To: Tomcat Users List Subject: Re: Tomcat - MySQL = No suitable driver ERROR Hold on a minute. I think we have a communication problem here. I wasn't recommending you do that. Slow down, take a breath and read my posts VERY carefully. We are looking at two different files here. DBTest.xml as a file containing the Context.../Context stuff should be in {TOMCAT_HOME}/conf/Catalina/localhost. Leave that alone. I was recommending you take the resource-ref.../resource-ref stuff you put in {TOMCAT_HOME}/webapps/DBTest/WEB-INF/DBTest.xml and put that in {TOMCAT_HOME}/webapps/DBTest/WEB-INF/web.xml. Both files are needed with their respective parts. The context definition needs to have the Resource/ and ResourceParams.../ResourceParams sections to define a connection pool and make it available in tomcat's JNDI name space. web.xml needs the resource-ref.../resource-ref stuff to make the connection pool avialable to your application. --David Briggs, Patrick wrote: Ok, I tried as you suggested, I deleted DBTest.xml out of the conf/Catalina/localhost directory and placed it inside my web.xml for the webapp itself. I rebooted my machine, restarted Tomcat, same error. Still nothing. Here is what my web.xml looks like now: ?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 descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/DBTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref 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 nameurl/name valuejdbc:mysql://cir-ops:3306/javatest?autoReconnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuejavadude/value /parameter /ResourceParams /Context /web-app -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 30, 2004 6:56 PM 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
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 nameurl/name valuejdbc:mysql://NAME_OR_IP_OF_MYSQL_SERVER:3306/NAME_OF_DATABASE?autoRec onnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valueUSERNAME/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuePASSWORD/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 -Original Message- From: Briggs, Patrick [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 30, 2004 12:01 AM To: '[EMAIL PROTECTED]' Subject: Tomcat - MySQL = No suitable driver ERROR I'm trying to setup Tomcat 5.0.25 to talk to a MySQL database and I've had no luck after several days of fighting with this thing. I'm following along the documentation at this URI: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-how to.html The example says to edit server.xml Add this in between the /Context tag of the examples context and the /Host tag closing the localhost definition. So far I've not found any Context example in server.xml. So that doesn't appear to exist. However, I have placed it before the /Host tag and have also tried putting it in the GlobalNamingResources as well, but that didn't make any difference for me. I have placed the mysql-connector-java-3.0.14-production-bin.jar file in /tomcat/common/lib as instructed. I have also tried placing it WEB-INF/lib, that didn't work. Also tried putting it in tomcat/server/lib and that didn't help either. I have the impressiont that the datasource-examples-howto is somehow out of date, hasn't been really tested much, or is just plain incorrect because I've found numerous other hits on GOOGLE.COM about this problem, but nobody really has much of a solution. Seems to me that setting this up shouldn't be this complicated. The error message I keep getting all the time is: 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(PageContextI mpl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp 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.java: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
RE: Tomcat - MySQL = No suitable driver ERROR
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 nameurl/name valuejdbc:mysql://NAME_OR_IP_OF_MYSQL_SERVER:3306/NAME_OF_DATABASE?autoRec onnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valueUSERNAME/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuePASSWORD/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.
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 nameurl/name valuejdbc:mysql://NAME_OR_IP_OF_MYSQL_SERVER:3306/NAME_OF_DATABASE?autoRec onnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valueUSERNAME/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuePASSWORD/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]
RE: Tomcat - MySQL = No suitable driver ERROR
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 nameurl/name valuejdbc:mysql://NAME_OR_IP_OF_MYSQL_SERVER:3306/NAME_OF_DATABASE?autoRe c onnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valueUSERNAME/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuePASSWORD/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.
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 nameurl/name valuejdbc:mysql://NAME_OR_IP_OF_MYSQL_SERVER:3306/NAME_OF_DATABASE?autoRe c onnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valueUSERNAME/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuePASSWORD/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
RE: Tomcat - MySQL = No suitable driver ERROR
Hi Patrick, shared/lib is quite ok - that is where mine resides and everything works just fine... The content of myWebApp,xml is straight out of my one two and my db connection works just fine. The question would be when and where you actually get that error. Have you turned on logging for your webapp and ensured that the jndi ressource is really there? There should be an entry (depending on your logging level) like this there: 2004-06-30 14:59:06 NamingContextListener[/Catalina/localhost/myWebApp]: Adding resource ref jdbc/myWebApp 2004-06-30 14:59:06 NamingContextListener[/Catalina/localhost/myWebApp]: ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factory ClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Shar eable},{type=auth,content=Container},{type=url,content=jdbc:mysql://loalhost :3306/myWebApp?autoReconnect=true},{type=maxIdle,content=15},{type=maxActive ,content=50},{type=driverClassName,content=com.mysql.jdbc.Driver},{type=maxW ait,content=1},{type=removeAbandoned,content=true},{type=username,conten t=myWebApp},{type=factory,content=org.apache.commons.dbcp.BasicDataSourceFac tory},{type=removeAbandonedTimeout,content=60},{type=password,content=secret }] If that does not help, add the following inside web-app of your web.xml (should be in webapps WEB-INF dir). resource-ref descriptionDB Connection/description res-ref-namejdbc/myWebApp/res-ref-name !-- exchange myWebApp with whatever you have named your datasource in the context/ -- res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Best you then delete all contents of {CATALINA_HOME}\work\localhost\myWebApp\ and restart Tomcat. Then check your logs and see whether it finds and intializes the ressource. HTH, Jan -Original Message- From: Briggs, Patrick [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 30, 2004 9:47 PM To: 'Tomcat Users List' Subject: RE: Tomcat - MySQL = No suitable driver ERROR 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 nameurl/name valuejdbc:mysql://NAME_OR_IP_OF_MYSQL_SERVER:3306/NAME_OF_DATABASE?au toRe c onnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valueUSERNAME/value /parameter
RE: Tomcat - MySQL = No suitable driver ERROR
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 nameurl/name valuejdbc:mysql://cir-ops:3306/javatest?autoReconnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuejavadude/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 descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/DBTest/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/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 titleDB Test/title /head body h2Results/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(PageContextI mpl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp 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.java: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.getConnection(Unk nown Source) org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(Unknow 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.java: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
Re: Tomcat - MySQL = No suitable driver ERROR
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 nameurl/name valuejdbc:mysql://NAME_OR_IP_OF_MYSQL_SERVER:3306/NAME_OF_DATABASE?autoR e c onnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameusername/name valueUSERNAME/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namepassword/name valuePASSWORD/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
Re: Tomcat - MySQL = No suitable driver ERROR
Ok, I stand corrected. If the jar works in shared/lib, then cool. I never argue with what works. I also stop experimenting when it starts working, so I've never tried it there. Thanks for the info. --David Jan Behrens wrote: Hi Patrick, shared/lib is quite ok - that is where mine resides and everything works just fine... The content of myWebApp,xml is straight out of my one two and my db connection works just fine. The question would be when and where you actually get that error. Have you turned on logging for your webapp and ensured that the jndi ressource is really there? There should be an entry (depending on your logging level) like this there: 2004-06-30 14:59:06 NamingContextListener[/Catalina/localhost/myWebApp]: Adding resource ref jdbc/myWebApp 2004-06-30 14:59:06 NamingContextListener[/Catalina/localhost/myWebApp]: ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factory ClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Shar eable},{type=auth,content=Container},{type=url,content=jdbc:mysql://loalhost :3306/myWebApp?autoReconnect=true},{type=maxIdle,content=15},{type=maxActive ,content=50},{type=driverClassName,content=com.mysql.jdbc.Driver},{type=maxW ait,content=1},{type=removeAbandoned,content=true},{type=username,conten t=myWebApp},{type=factory,content=org.apache.commons.dbcp.BasicDataSourceFac tory},{type=removeAbandonedTimeout,content=60},{type=password,content=secret }] If that does not help, add the following inside web-app of your web.xml (should be in webapps WEB-INF dir). resource-ref descriptionDB Connection/description res-ref-namejdbc/myWebApp/res-ref-name !-- exchange myWebApp with whatever you have named your datasource in the context/ -- res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Best you then delete all contents of {CATALINA_HOME}\work\localhost\myWebApp\ and restart Tomcat. Then check your logs and see whether it finds and intializes the ressource. HTH, Jan -Original Message- From: Briggs, Patrick [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 30, 2004 9:47 PM To: 'Tomcat Users List' Subject: RE: Tomcat - MySQL = No suitable driver ERROR 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 nameurl/name valuejdbc:mysql://NAME_OR_IP_OF_MYSQL_SERVER:3306/NAME_OF_DATABASE?au toRe c onnect=true/value /parameter parameter namemaxIdle/name value15/value /parameter parameter namemaxActive/name value50/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter namemaxWait
RE: Tomcat - MySQL = No suitable driver ERROR
here maybee it could help you! im using mysql database whit Tomcat4.0 and the config look like this! first download mysql-connector-java-3.0.10-stable-bin read install instruction (or simply copy the file under Tomcat_home/comon/lib) the conection acess to database ! xml DRIVERcom.mysql.jdbc.Driver/DRIVER URLjdbc:mysql://localhost:port/database name/URL LOGINroot/LOGIN PASSWORD/PASSWORD the pasword is not neded if you use localhost hope it help you friendly frank [EMAIL PROTECTED] administrateur http://entre-nous.qc.tc From: Briggs, Patrick [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: Tomcat - MySQL = No suitable driver ERROR Date: Tue, 29 Jun 2004 15:00:59 -0700 I'm trying to setup Tomcat 5.0.25 to talk to a MySQL database and I've had no luck after several days of fighting with this thing. I'm following along the documentation at this URI: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-how to.html The example says to edit server.xml Add this in between the /Context tag of the examples context and the /Host tag closing the localhost definition. So far I've not found any Context example in server.xml. So that doesn't appear to exist. However, I have placed it before the /Host tag and have also tried putting it in the GlobalNamingResources as well, but that didn't make any difference for me. I have placed the mysql-connector-java-3.0.14-production-bin.jar file in /tomcat/common/lib as instructed. I have also tried placing it WEB-INF/lib, that didn't work. Also tried putting it in tomcat/server/lib and that didn't help either. I have the impressiont that the datasource-examples-howto is somehow out of date, hasn't been really tested much, or is just plain incorrect because I've found numerous other hits on GOOGLE.COM about this problem, but nobody really has much of a solution. Seems to me that setting this up shouldn't be this complicated. The error message I keep getting all the time is: 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(PageContextI mpl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp 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.java: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.getConnection(Unk nown Source) org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(Unknow 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.java: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) server.xml: !-- Example Server Configuration File -- !-- Note that component elements are nested corresponding to their parent-child relationships with each other -- !-- A Server is a singleton element that represents the entire JVM, which may contain one or more Service instances. The Server listens for a shutdown command on the indicated port. Note: A Server is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- Server port=8005 shutdown=SHUTDOWN debug=0 !-- Comment these entries out to disable JMX MBeans support -- !-- You may also configure custom components (e.g. Valves/Realms) by including your own mbean-descriptor file(s), and setting the descriptors attribute to point to a ';' seperated list of paths (in the ClassLoader sense) of files to add to the default list. e.g. descriptors=/com/myfirm/mypackage/mbean-descriptor.xml -- Listener className=org.apache.catalina.mbeans.ServerLifecycleListener debug=0/ Listener