tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: newbie having problems with MySQL JDBC/JNDI Datasource example
Date Wed, 02 Mar 2005 12:27:03 GMT
In your context definition, you have <Resource name="TestDB"......

In your web.xml, you have <res-ref-name>jdbc/TestDB</res-ref-name>

These two need to match.  If one is jdbc/TestDB, so must the other.

--David


Darryl Wagoner wrote:

> Greetings,
>
> Not sure if this made it the first time.  I didn't see it show up on 
> the list
>
> I am trying to get the example in the MySQL JDBC/JNDI HOWTO to work 
> and I am missing something.
>
> I get this error:  My webapp directory is /DBTest.
>
> What am I missing?
>
> thanks
>
> -darryl
>
>
> --- Error Page ---
>
> *type* Exception report
>
> *message*
>
> *description* _The server encountered an internal error () that 
> prevented it from fulfilling this request._
>
> *exception*
>
> javax.servlet.ServletException: Unable to get connection, DataSource 
> invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot 
> create JDBC driver of class '' for connect URL 'null'"
>     org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:845)

>
>     org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:778)

>
>     org.apache.jsp.testDB_jsp._jspService(org.apache.jsp.testDB_jsp:81)
>     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325) 
>
>     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) 
>
>     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> *root cause*
>
> javax.servlet.jsp.JspException: Unable to get connection, DataSource 
> invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot 
> create JDBC driver of class '' for connect URL 'null'"
>     org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)

>
>     org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)

>
>     org.apache.jsp.testDB_jsp._jspx_meth_sql_query_0(org.apache.jsp.testDB_jsp:100) 
>
>     org.apache.jsp.testDB_jsp._jspService(org.apache.jsp.testDB_jsp:58)
>     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325) 
>
>     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) 
>
>     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
>
> --- Server.xml ---
> <?xml version='1.0' encoding='utf-8'?>
> <!-- $Id$ -->
> <Server>
>
>  <Listener 
> className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
>  <Listener 
> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListen
> er"/>
>  <GlobalNamingResources>
>    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
>    <Resource auth="Container" description="User database that can be 
> updated an
> d saved"
>    name="UserDatabase" type="org.apache.catalina.UserDatabase"
>    pathname="conf/tomcat-users.xml" 
> factory="org.apache.catalina.users.MemoryUs
> erDatabaseFactory"/>
>
>  </GlobalNamingResources>
>
>  <Service name="Catalina">
>    <Connector port="8080" redirectPort="8443" maxSpareThreads="75" 
> maxThreads="150" minSpareThreads="25">
>    </Connector>
>    <Connector port="8081" proxyName="dax.shecora.com" proxyPort="80"
>    redirectPort="8443" maxSpareThreads="75" maxThreads="150" 
> minSpareThreads="25">
>    </Connector>
>    <Connector port="8009" protocol="AJP/1.3"
>    protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" 
> redirectPort="8443">
>    </Connector>
>
>    <Engine defaultHost="localhost" name="Catalina">
>      <Host appBase="webapps" name="localhost">
>      <Context path="/DBTest" docBase="DBTest" debug="5">
>      reloadable="true" crossContext="true">
>          <Resource name="TestDB" type="javax.sql.DataSource" 
> password="javadude"
>          driverClassName="com.mysql.jdbc.Driver" maxIdle="2" 
> maxWait="5000" username="javauser"
>          url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"
>          maxActive="4"/>
>      </Context>
>
>
> --- web.xml ---
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
>    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>    "http://java.sun.com/dtd/web-app_2_3.dtd">
>
>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" 
> xmlns:xsi="http://www.w3.org/20
> 01/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/TestDB</res-ref-name>
>      <res-type>javax.sql.DataSource</res-type>
>      <res-auth>Container</res-auth>
>  </resource-ref>
> </web-app>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message