Hi Scott,

I had also this problem some time back. You need to create a file named
context.xml in WEB-APP/META-INF directory. The resource needs to be
defined her as follows

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <Resource
      name="jdbc/BuilderDB"
type=
      password="admin"
      driverClassName="com.mysql.jdbc.Driver"
factory=
      maxIdle="2"
      maxWait="5000"
      validationQuery="select * from test "
      username="root"
      url="jdbc:mysql://localhost/builder"
      maxActive="4"/>
</Context>

Note in the above that the value of attribute 'type' should be the
DataSource class from your db driver jar. Also you need to define the
attribute 'factory' which is the impl class from your db driver jar
implementating javax.sql.ConnectionPoolDataSource.

Please check that the url is correct. I think you need to specify the
port along with localhost.
 
Regards,
Jitendra

-----Original Message-----
From: Scott Purcell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 28, 2006 7:03 PM
To: users@tomcat.apache.org
Subject: Tomcat 5.5 JNDI Question Using Admin

Hello,

 

I am receiving errors when configuring a JNDI resource for my database
using Tomcat 5.5 on a Windoz box. I used the admin interface and entered
the following data:

in admin screen

under  Data Sources

JNDI Name= jdbc/BuilderDB

Driver com.mysql.jdbc.Driver

Data Source URL=jdbc:mysql://localhost/builder

JDBC Driver Class=com.mysql.jdbc.Driver

 

Then I made sure my driver was in

common/lib/mysql-connector-java-3.1.12

 

 

Then went to the web.xml file added my resource

web.xml

  <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/BuilderDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>

 

 

After committing the change in the admin module, it updated the
server.xml and added this the <Resource (see below).

When I try and get a jndi connection doing a lookup, I get this error
(see below).

 

As I read the docs for 5.5, and I do not see any examples. Does anyone
see any problems with this, or know what may cause this error?

 

 

Thanks,

Scott

 

 

 

 

error

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'
 at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSo
urce.java:780)
 at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSourc
e.java:540)
 at foo.DBTest.init(DBTest.java:23)
 at org.apache.jsp.test_jsp._jspService(test_jsp.java:51)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:332)
 at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:252)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
 at
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.
java:142)

 

 

 

 

 

Server.xml

<?xml version="1.0" encoding="UTF-8"?>
<Server>
  <Listener className="org.apache.catalina.core.AprLifecycleListener"/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/
>
  <Listener
className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"
/>
  <Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <GlobalNamingResources>
    <Environment
      name="simpleValue"
      type="java.lang.Integer"
      value="30"/>
    <Resource
      auth="Container"
      description="User database that can be updated and saved"
      name="UserDatabase"
      type="org.apache.catalina.UserDatabase"
      pathname="conf/tomcat-users.xml"
      factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/>
    <Resource
      name="jdbc/BuilderDB"
      type="javax.sql.DataSource"
      password="admin"
      driverClassName="com.mysql.jdbc.Driver"
      maxIdle="2"
      maxWait="5000"
      validationQuery="select * from test "
      username="root"
      url="jdbc:mysql://localhost/builder"
      maxActive="4"/>
  </GlobalNamingResources>
  <Service
      name="Catalina">
    <Connector
        port="8080"
        redirectPort="8443"
        minSpareThreads="25"
        connectionTimeout="20000"
        maxThreads="150"
        maxSpareThreads="75">
    </Connector>
    <Connector
        port="8009"
        redirectPort="8443"
        protocol="AJP/1.3">
    </Connector>
    <Engine
        defaultHost="localhost"
        name="Catalina">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
      <Host
          appBase="webapps"
          name="localhost">
      </Host>
    </Engine>
  </Service>
</Server>

 

 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to