[
https://issues.apache.org/jira/browse/OPENJPA-2915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17769430#comment-17769430
]
Dominik Stadler commented on OPENJPA-2915:
--
Thanks for the links and the workaround, I can confirm that using
"MaxWaitMillis" makes it work again with latest dbcp2 in my projects.
> commons-dbcp2 2.10.0 breaks OpenJPA because of changed configuration methods
>
>
> Key: OPENJPA-2915
> URL: https://issues.apache.org/jira/browse/OPENJPA-2915
> Project: OpenJPA
> Issue Type: Bug
> Components: third-party
>Affects Versions: 3.2.2
>Reporter: Dominik Stadler
>Assignee: Mark Struberg
>Priority: Minor
> Labels: patch
>
> When upgrading commons-dbcp2 to the latest version 2.10.0, OpenJPA fails with
> exceptions when it tries to provide options to commons-dbcp2.
> It seems this happens because dbcp2 moved from Integer-Duration to using
> java.time.Duration.
> See
> [https://github.com/apache/commons-dbcp/commit/93207813fd6b6c0230cfcebb0e9f5b19e9fa72b9]
> It seems that even though the change in dbcp2 was done in a
> backwards-compatible way, the automatic configuration handling in OpenJPA
> stumbles and throws an exception when latest commons-dbcp2 (and
> commons-pool2) are used:
> {noformat}
> Caused by: org.apache.openjpa.lib.util.ParseException:
> org.apache.commons.dbcp2.BasicDataSource@72eed4db.MaxWait = 1
> at app//org.apache.openjpa.lib.util.Options.setInto(Options.java:234)
> at app//org.apache.openjpa.lib.util.Options.setInto(Options.java:187)
> at
> app//org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:502)
> at
> app//org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:456)
> at
> app//org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:436)
> at
> app//org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.java:169)
> at
> app//org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:112)
> ... 63 more
> Caused by: org.apache.openjpa.lib.util.ParseException: Error initializing
> configuration. Failed to create an instance of class java.time.Duration for
> plugin property 1.
> at
> app//org.apache.openjpa.lib.util.Options.stringToObject(Options.java:449)
> at app//org.apache.openjpa.lib.util.Options.setInto(Options.java:226)
> ... 69 more
> Caused by: java.lang.ClassNotFoundException: 1
> at
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
> at
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
> at java.base/java.lang.Class.forName0(Native Method)
> at java.base/java.lang.Class.forName(Class.java:315)
> at org.apache.openjpa.lib.util.Options.stringToObject(Options.java:446)
> ... 70 more
> {noformat}
>
> It should be possible to reproduce with a small OpenJPA sample project and
> adding the following two newer Gradle dependencies:
> {noformat}
> implementation 'org.apache.commons:commons-dbcp2:2.10.0'
> implementation 'org.apache.commons:commons-pool2:2.11.1'{noformat}
>
> Edit: Fixed version to "2.10.0"
--
This message was sent by Atlassian Jira
(v8.20.10#820010)