[ 
https://issues.apache.org/jira/browse/POOL-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16430519#comment-16430519
 ] 

Michael C commented on POOL-338:
--------------------------------

Nice touch. Here is the new log that shows two class loaders:

java.lang.IllegalArgumentException: Class 
org.apache.commons.pool2.impl.DefaultEvictionPolicy from class loader [Thread 
context class loader: 
org.eclipse.osgi.internal.framework.ContextFinder@383d49e2] does not implement 
org.apache.commons.pool2.impl.EvictionPolicy from class loader 
[org.eclipse.osgi.internal.loader.EquinoxClassLoader@d099faf[com.rivetlogic.liferay.store.box:1.0.0(id=42)]]

Since the error came from line 618 _{{if (policy instanceof 
EvictionPolicy<?>)}}_, it makes sense to me to use the same class loader of 
EvictionPolicy to load _{{policy}}_ in line 608:

{{    final ClassLoader classLoader = EvictionPolicy.class.getClassLoader();}}

It works in my OSGi environment.

> GenericObjectPool constructor throws an exception
> -------------------------------------------------
>
>                 Key: POOL-338
>                 URL: https://issues.apache.org/jira/browse/POOL-338
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.4.2, 2.4.3, 2.5.0
>         Environment: Java 8, Liferay DXP (an OSGi environment).
>            Reporter: Michael C
>            Priority: Major
>
> Version 2.4.3 GenericObjectPool constructor throws this exception:
> {{java.lang.IllegalArgumentException: 
> [org.apache.commons.pool2.impl.DefaultEvictionPolicy] does not implement 
> EvictionPolicy}}
> {{    at 
> org.apache.commons.pool2.impl.BaseGenericObjectPool.setEvictionPolicyClassName(BaseGenericObjectPool.java:618)}}
> {{    at 
> org.apache.commons.pool2.impl.GenericObjectPool.setConfig(GenericObjectPool.java:318)}}
> {{    at 
> org.apache.commons.pool2.impl.GenericObjectPool.<init>(GenericObjectPool.java:115)}}
> {{    at 
> org.apache.commons.pool2.impl.GenericObjectPool.<init>(GenericObjectPool.java:88)}}
>  
> Version 2.5.0 throws the same exception. Version 2.4.2 or older's 
> setEvictionPolicyClassName method fail silently for the same reason. This 
> line in BaseGenericObjectPool evaluates to false for all versions:
> {{        if (policy instanceof EvictionPolicy<?>) {}}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to