Uploaded image for project: 'Commons Pool'
  1. Commons Pool
  2. POOL-292

ClassNotFoundException: org.apache.commons.pool2.impl.DefaultEvictionPolicy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Pending Closed
    • 2.3
    • 2.4.1
    • Apache Karaf OSGi

    Description

      Here is my application structure:
      myapplication-bundle(uses mybatis) --> datasource-bundle (uses commons-dbcp2) --> commons-pool2 bundle.

      With this structure, all the datasource API information are hidden from my application and only javax.sql.DataSource is exported from the datasource-bundle. So I do not have OSGi import package for org.apache.commons.pool2.impl in my application.

      But on version 2.3 of commons-pool2, the method org.apache.commons.pool2.impl.BaseGenericObjectPool.setEvictionPolicyClassName is using Thread.currentThread().getContextClassLoader() to load EvicationPolicy class, which means it is using the class loader of myapplication to load org.apache.commons.pool2.impl.DefaultEvictionPolicy class. Since I do not have that in myapplication-bundle's OSGi Import-Package, I get a ClassNotFound exception.

      This issue did not happen in commons-pool2 version 2.2 because, it did not use the current thread's class loader to instantiate the eviction policy. Due to this, I am kinda forced to use 2.2 version in my environment and i would like to stay on the latest version due to all the bug fixes with concurrency.

      Any help would be really appreciated.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ah.narayanan Narayanan Harihara
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: