tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reshma Bhatia" <reshma.bha...@patni.com>
Subject Re: JDBC connection - Please help
Date Tue, 22 Feb 2005 12:19:06 GMT
Hi,

Looks like you are using the Tomcat Connection pool.
Refer to the attached Readme.txt file and verify that you have done these
steps.
I think it should solve your problem.

Have also attached the server.xml & web.xml files which worked fine for us.
let me know whether ur problem gets solved by this.

-----Original Message-----
From: deepak suldhal [mailto:deepakatfre@yahoo.com]
Sent: Monday, February 21, 2005 11:53 AM
To: tomcat users
Subject: JDBC connection - Please help


Please help me make my first JDBC connection
My web.xml

<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/TestDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>
</web-app>
----------------------------------------------------------------------------
---
In server.xml I have the following context ( trying to connect to Sybase
database)
<Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true"
crossContext="true">
    <Resource name="jdbc/TestDB" auth="Container"
                    type="javax.sql.DataSource"
                maxActive="100" maxIdle="30" maxWait="10000"
                username="javauser" password="javadude"
                driverClassName="com.sybase.jdbc2.jdbc.SybDriver"
                url="jdbc:sybase:Tds:re2unx188:2025"/>
</Context>
----------------------------------------------------------------------------
---
I have copied the JDCB drive Jar under
commons/lib
I have a test.jsp as follows
----------------------------------------------------------------------------
---
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query var="rs" dataSource="jdbc/TestDB">
select id, 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>
----------------------------------------------------------------------------
---
My directory structue is as follows
webapps/DBTest/WEB-INF/web.mxl
              /DBTest/test.jsp
----------------------------------------------------------------------------
---
And when I try the url
http://localhost:8080/DBTest/test.jsp
I am getting the following errors
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.commons.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'"

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:82)

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
24)

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:802)
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'"

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:101)
                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:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
24)

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:802

----------------------------------------------------------------------------
---
My console server display is as follows
eb 20, 2005 10:31:08 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 20, 2005 10:31:08 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1422 ms
Feb 20, 2005 10:31:09 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 20, 2005 10:31:09 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.0.28
Feb 20, 2005 10:31:09 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Feb 20, 2005 10:31:10 PM org.apache.catalina.core.StandardHost getDeployer
INFO: Create Host deployer for direct deployment ( non-jmx )
Feb 20, 2005 10:31:10 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\admin.xml
Feb 20, 2005 10:31:10 PM org.apache.struts.util.PropertyMessageResources
<init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
Feb 20, 2005 10:31:10 PM org.apache.struts.util.PropertyMessageResources
<init>
INFO: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
Feb 20, 2005 10:31:11 PM org.apache.struts.util.PropertyMessageResources
<init>
INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources',
returnNull=true
Feb 20, 2005 10:31:13 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\balancer.xml
Feb 20, 2005 10:31:14 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\CurrencyConverter.xml
Feb 20, 2005 10:31:14 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\expressionLanguage.xml
Feb 20, 2005 10:31:14 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\Fin46.xml
Feb 20, 2005 10:31:14 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\Fupload.xml
Feb 20, 2005 10:31:15 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\Hangman.xml
Feb 20, 2005 10:31:15 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\helloworld.xml
Feb 20, 2005 10:31:15 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\Interactivehelloworld.
xml
Feb 20, 2005 10:31:15 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\jstltest.xml
Feb 20, 2005 10:31:15 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\manager.xml
Feb 20, 2005 10:31:15 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\ServletExamples.xml
Feb 20, 2005 10:31:15 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL
file:C:\jakarta-tomcat-5.0.28\conf\Catalina\localhost\store.xml
Feb 20, 2005 10:31:16 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Installing web application at context path /sample from URL
file:C:/jakarta-tomcat-5.0.28/webapps/sample
Feb 20, 2005 10:31:16 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Installing web application at context path /jsp-examples from URL
file:C:\jakarta-tomcat-5.0.28\webapps\jsp-examples
Feb 20, 2005 10:31:16 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Installing web application at context path  from URL
file:C:\jakarta-tomcat-5.0.28\webapps\ROOT
Feb 20, 2005 10:31:16 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Installing web application at context path /servlets-examples from URL
file:C:\jakarta-tomcat-5.0.28\webapps\servlets-examples
Feb 20, 2005 10:31:16 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Installing web application at context path /tomcat-docs from URL
file:C:\jakarta-tomcat-5.0.28\webapps\tomcat-docs
Feb 20, 2005 10:31:17 PM org.apache.catalina.core.StandardHostDeployer
install
INFO: Installing web application at context path /webdav from URL
file:C:\jakarta-tomcat-5.0.28\webapps\webdav
Feb 20, 2005 10:31:17 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 20, 2005 10:31:17 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
Feb 20, 2005 10:31:17 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=10/40
config=C:\jakarta-tomcat-5.0.28\conf\jk2.properties
Feb 20, 2005 10:31:17 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8835 ms


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete  this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at netadmin@patni.com and delete this mail. 
_____________________________________________________________________

Mime
View raw message