Narayanan Harihara created POOL-292:
---------------------------------------

             Summary: ClassNotFoundException: 
org.apache.commons.pool2.impl.DefaultEvictionPolicy
                 Key: POOL-292
                 URL: https://issues.apache.org/jira/browse/POOL-292
             Project: Commons Pool
          Issue Type: Bug
    Affects Versions: 2.3
         Environment: Apache Karaf OSGi
            Reporter: Narayanan Harihara


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 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 my 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. 




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to