Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6818551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:11:33+00:00 2026-05-26T21:11:33+00:00

I am trying to run this example http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/doc/PoolingDataSourceExample.java?view=markup but somehow I am not able

  • 0

I am trying to run this example http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/doc/PoolingDataSourceExample.java?view=markup but somehow I am not able to do it. And I want to run this example in an maven project and also I am working on the maven project for the first time. And I am not sure how should I do it. As in that example it clearly states that-

To compile this example, you'll want:
  * commons-pool-1.5.4.jar
  * commons-dbcp-1.2.2.jar
  * j2ee.jar (for the javax.sql classes)
 in your classpath.

 To run this example, you'll want:
  * commons-pool-1.5.6.jar
  * commons-dbcp-1.3.jar (JDK 1.4-1.5) or commons-dbcp-1.4 (JDK 1.6+)
  * j2ee.jar (for the javax.sql classes)
  * the classes for your (underlying) JDBC driver
 in your classpath.

So I tried adding all these dependencies into my pom.xml file after going through various articles. But still I am having error like–

ConnectionFactory cannot be resolved to a type  
GenericObjectPool cannot be resolved to a type  
ObjectPool cannot be resolved to a type 
PoolableConnectionFactory cannot be resolved to a type  
PoolableConnectionFactory cannot be resolved to a type  
PoolingDataSource cannot be resolved to a type  
PoolingDataSource cannot be resolved to a type  

And this is my pom.xml file. Is there anything that I am missing in my pom.xml file. Any suggestions will be appreciated as this is my first time with maven project.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.datasource.pooling</groupId>
  <artifactId>datasource.pooling</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>com.datasource.pooling</name>




  <dependencies>

  <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0</version>
        </dependency>


<dependency>
      <groupId>commons-pool</groupId>
      <artifactId>commons-pool</artifactId>
      <version>1.5.4</version>
    </dependency>

    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
      <version>1.2.2</version>
    </dependency>
<!--  
<dependency>
      <groupId>commons-pool</groupId>
      <artifactId>commons-pool</artifactId>
      <version>1.5.6</version>
    </dependency>

    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
      <version>1.3</version>
    </dependency>
 -->

  </dependencies>
</project>

What is the dependency for adding j2ee.jar file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:11:33+00:00Added an answer on May 26, 2026 at 9:11 pm

    ConnectionFactory, GenericObjectPool,ObjectPool,PoolableConnectionFactory,PoolingDataSource classes can be found in jars commons-pool-{version}.jar and commons-dbcp-{version}.jar.

    In this case, you don’t have to add j2ee.jar. javax.sql package related classes are inside rt.jar which comes default in jdk.
    The code (http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/doc/PoolingDataSourceExample.java?view=markup) you have to run is importing classes from package org.apache.commons.dbcp2 and org.apache.commons.pool2

    import org.apache.commons.pool2.ObjectPool; 
    import org.apache.commons.pool2.impl.GenericObjectPool;      
    import org.apache.commons.dbcp2.ConnectionFactory;   
    import org.apache.commons.dbcp2.PoolingDataSource;   
    import org.apache.commons.dbcp2.PoolableConnectionFactory;   
    import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
    

    instead use

    import org.apache.commons.pool.ObjectPool; 
    import org.apache.commons.pool.impl.GenericObjectPool;   
    import org.apache.commons.dbcp.ConnectionFactory;    
    import org.apache.commons.dbcp.PoolingDataSource;    
    import org.apache.commons.dbcp.PoolableConnectionFactory;    
    import org.apache.commons.dbcp.DriverManagerConnectionFactory;
    

    use org.apache.commons.pool instead of org.apache.commons.pool2 from all the package imports.
    These classes are inside commons-pool-{version}.jar and commons-dbcp-{version}.jar jars.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run the Camel Example camel-example-spring-jms (also at http://activemq.apache.org/camel/tutorial-jmsremoting.html ). However, when
I am trying to run this example program - http://pysnmp.sourceforge.net/examples/1.x/snmpbulk.html I am on Mac
I am trying to follow this example from MSDN: http://msdn.microsoft.com/en-us/library/a1hetckb.aspx I think i'm doing
I am trying to run this snippet from http://www.ibm.com/developerworks/linux/library/l-prog3.html on a python 2.6 runtime.
I am just trying to compile this simple example : http://msdn.microsoft.com/en-us/library/ms533895(VS.85).aspx what needs to
I'm trying to run this example: https://github.com/larsgeorge/hbase-book/blob/master/ch03/src/main/java/client/PutExample.java , from this book: http://ofps.oreilly.com/titles/9781449396107/ , on
I have been trying to work with app.config sections by this example: http://msdn.microsoft.com/en-us/library/system.configuration.configurationcollectionattribute.aspx#Y2391 and
I am trying to run this dreadfully simple command in Bash java -cp nasa-top-secret.jar
I'm trying to run this code: let coins = [50, 25, 10, 5, 2,1]
I'm trying to run this for loop; for (int col= 0; grid[0].length; col++) However

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.