You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Benjamin Cuthbert <cu...@gmail.com> on 2006/07/14 12:10:55 UTC

Error loading DBCP NoClassDefFoundError

All when i try and use the DBCP code i get the following error

java.lang.NoClassDefFoundError:
org/apache/commons/pool/impl/GenericObjectPool
        at complexcvfeed.OraThin.setupDataSource(OraThin.java:77)
        at complexcvfeed.OraThin.<init>(OraThin.java:35)

ANd in my class OraThin line 77 i have

   public static DataSource setupDataSource(String connectURI) {
       BasicDataSource ds = null;
        ds = new BasicDataSource();
        ds.setDriverClassName("oracle.jdbc.driver.OracleDriver");
        ds.setUsername("user");
        ds.setPassword("pass");
        ds.setUrl(connectURI);
       return ds;
   }

And 35 i have

        String dbUrl = "jdbc:oracle:thin:user/pass@dbhostname.uk.db.com:1521
:SID";
        DataSource dataSource = setupDataSource(dbUrl);

I have the commons-dbcp-1.2.1.jar in the class path, so i don't understand
why it does not work

Re: Error loading DBCP NoClassDefFoundError

Posted by Dennis Lundberg <de...@apache.org>.
Benjamin Cuthbert wrote:
> All when i try and use the DBCP code i get the following error
> 
> java.lang.NoClassDefFoundError:
> org/apache/commons/pool/impl/GenericObjectPool
>        at complexcvfeed.OraThin.setupDataSource(OraThin.java:77)
>        at complexcvfeed.OraThin.<init>(OraThin.java:35)
> 
> ANd in my class OraThin line 77 i have
> 
>   public static DataSource setupDataSource(String connectURI) {
>       BasicDataSource ds = null;
>        ds = new BasicDataSource();
>        ds.setDriverClassName("oracle.jdbc.driver.OracleDriver");
>        ds.setUsername("user");
>        ds.setPassword("pass");
>        ds.setUrl(connectURI);
>       return ds;
>   }
> 
> And 35 i have
> 
>        String dbUrl = "jdbc:oracle:thin:user/pass@dbhostname.uk.db.com:1521
> :SID";
>        DataSource dataSource = setupDataSource(dbUrl);
> 
> I have the commons-dbcp-1.2.1.jar in the class path, so i don't understand
> why it does not work
> 

You also need commons-pool in your class path.

"The commons-dbcp package relies on code in the commons-pool package to 
provide the underlying object pool mechanisms that it utilizes."

-- 
Dennis Lundberg

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