Closed
Description
Cristi Vulpe (Migrated from LDAP-316) said:
I have tried to upgrade from commons-pool version 1.6 to commons-pool2 version 2.2 and I get this exception:
java.lang.NoClassDefFoundError: org/apache/commons/pool/KeyedPoolableObjectFactory
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)
at java.lang.Class.getDeclaredMethods(Class.java:1962)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:570)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:489)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:473)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:241)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1059)
at
....
I have a bean that looks like this:
<bean id="ldapContextSource"
class="org.springframework.ldap.pool.factory.PoolingContextSource">
...
</bean>
When I looked at the source code for PoolingContextSource.java I found that it is using the naming convention from commons-pool 1.x:
import org.apache.commons.pool.impl.GenericKeyedObjectPool;
.
Is it possible to:
- Upgrade to the latest version (will very likely break backwards compatibility)?
- Provide an implementation that is sensitive to the classpath entries (i.e. detect which implementation to use)?
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
spring-projects-issues commentedon Dec 19, 2014
Michael Osipov said:
I am highly interested in this. Pool 1.x and 2.x are not compatible and different package names.
spring-projects-issues commentedon Oct 6, 2015
Anindya Chatterjee said:
Any update on this issue? Any road map for the implementation?
If not yet, I'll work on it and create PR.
spring-projects-issues commentedon Oct 6, 2015
Rob Winch said:
anidotnet Thanks for the offer for making a PR! We would greatly appreciate it. Please ensure any PR that is submitted is passive so as not to break existing users.
spring-projects-issues commentedon Oct 10, 2015
Anindya Chatterjee said:
I have submitted the PR as promised.
[https://github.com//pull/33]
spring-projects-issues commentedon Oct 14, 2015
Anindya Chatterjee said:
Any update please about merging the PR?
spring-projects-issues commentedon Jan 18, 2016
Rob Winch said:
This is resolved in master
salmanVD commentedon Aug 4, 2019
@spring-issuemaster This issue still exists with latest Ldap core 2.3.2 release. When this will be fixed?
snytkine commentedon Jan 27, 2020
I too have this issue right now with spring boot 2.2.3
The whole reason for using spring-ldap was the idea of support for ldap pool, but unfortunately there is this bug.
Is anyone working on fixing this issue?
nulliver commentedon Feb 15, 2020
@snytkine @salmanVD commons-pool2 is working fine for me with Spring LDAP Core version 2.3.2. One thing you have to consider is that there are two classes, one is for commons-pool and the other is for commons-pool2.
For commons-pool 1.x use the class:
org.springframework.ldap.pool.factory.PoolingContextSource
For commons-pool 2.x use class:
org.springframework.ldap.pool2.factory.PooledContextSource
Note that the first one is in the pool subpackage while the second one on the pool2 subpackage. Also, the name of the commons-pool2 class starts with Pooled while the commons-pool 1 starts with Pooling
The Spring LDAP documentation does not mention this difference in the Pooling Support section, I found out about this by looking at the code of spring-ldap-core.
Sample code: