Pedro,

You need javax.sql - that is the package containing DataSource.
Your Resource type should be: type="javax.sql.DataSource"
You need these parameters in addition to url, username and password:
      <parameter>
        <name>driverClassName</name>
        <value>oracle.jdbc.driver.OracleDriver</value>
      </parameter>
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>

In the Context the ResourceLink type should be: type="javax.sql.DataSource"

You do not need any resource-ref in your web.xml - just use your ResourceLink name as 
follows:
        Context ctx = new InitialContext();
        Context envCtx = (Context) ctx.lookup("java:/comp/env/");
        DataSource ds = (DataSource) envCtx.lookup("/{name_of_resource_link}");

        if (ds != null) {
                DbCon = ds.getConnection();
        }

Hope this helps.

-----Original Message-----
From: Pedro Salazar [mailto:[EMAIL PROTECTED]]
Sent: Montag, 09. Dezember 2002 13:49
To: Tomcat Users List
Subject: oracle+tomcat 4.1.x+dbcp = driverClassName is required!


Greetings,

I'm getting this exception when I try to lookup and cast a DataSource:

[catalina.out]
javax.naming.NamingException: DbcpDataSourceFactory: driverClassName is
required
org.apache.naming.factory.DbcpDataSourceFactory.getObjectInstance(DbcpDataSourceFactory.java:199)
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:177)
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
 org.apache.naming.NamingContext.lookup(NamingContext.java:835)
...

[server.xml]
I'm using a <resource> inside <globalNamingResources> and linked with
<resourceLink> in <context> (but I already tried a explicit <resource>
inside <context>).

[web.xml]
I'm using a <resource-ref>.

System: 
-tomcat 4.1.2 (JavaWebServicesDeveloperPack 1.0.1)
-dbcp 1.0
-jdbc oracle driver (renamed to jar and without javax.sql package) in
common/lib directory.

But I know that the driver is being loaded because before call my web
application, I saw this info message in catalina.out:
"
DbcpDataSourceFactory:  driverClassName=oracle.jdbc.driver.OracleDriver,
url=jdbc:oracle:thin:@192.168.89.52:1521:dbtest, user=test_01
"

I don't know why but it works fine in tomcat 4.0.6 I got it in other
machine. So, what is the problem here?

If need I can supply the exactly configurations (resource, resource-ref,
...).

thanks,
Pedro Salazar.

-- 
pedro salazar (pt-inovacao) <[EMAIL PROTECTED]>
key id: D803BC61


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to