[
https://issues.apache.org/jira/browse/OPENJPA-2915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17769410#comment-17769410
]
Maxim Solodovnik commented on OPENJPA-2915:
-------------------------------------------
Hello [[email protected]],
sorry for my quick and inaccurate answer, I have to read bug description before
posting :(
My answer is based on these 2 discussions:
https://lists.apache.org/thread/g99k2d07k95o8rwph7sdtol8j91n90t8
https://lists.apache.org/thread/5qq1pdcn13y392vpdpnvmvcd3fs5mnt3
According to the issue:
I was able to reproduce it using our application
The code need to tweaked, I'll try to create PR :)
meanwhile as a simple workaround you can use {{maxWaitMillis=10000}} instead of
{{MaxWait=10000}}
> 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
>
> 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:
> [email protected] = 10000
> 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 10000.
> 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: 10000
> 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)