tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Cheng" <stevech...@schednet.com>
Subject jndi-datasource
Date Wed, 01 Sep 2004 08:45:01 GMT
I follow the tomcat document and try to setup JNDI in tomcat.
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-how
to.html

But I get the following exception.
javax.servlet.ServletException: 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.testDB_jsp._jspService(testDB_jsp.java:81)
 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)

However, If I create the following tag in the Context tag, it works fine.
  <ResourceLink global="jdbc/sysdev/workflow" name="jdbc/sysdev/workflow"
type="javax.sql.DataSource"/>

Anybody know how to solve it?

Thanks,
steve

------------------------------------------------------------

Tomcat Version: 5.0.27
JDBC Driver: jtds
OS: Win2k server

segment of server.xml
<?xml version='1.0' encoding='utf-8'?>
<Server>
...
  <GlobalNamingResources>
...
    <Resource auth="Container" description="Workflow DB Connection"
name="jdbc/sysdev/workflow" type="javax.sql.DataSource"/>
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>
    <ResourceParams name="jdbc/sysdev/workflow">
      <parameter>
        <name>validationQuery</name>
        <value>select top 1 * from login</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:jtds:sqlserver://sysdev/workflow</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value></value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>4</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>5000</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>net.sourceforge.jtds.jdbc.Driver</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>sa</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>2</value>
      </parameter>
    </ResourceParams>
  </GlobalNamingResources>
...
</Server>

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 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">
  <display-name>Workflow</display-name>
  <description>Workflow</description>
  <resource-ref>
      <description>Workflow DB Connection</description>
      <res-ref-name>jdbc/sysdev/workflow</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