[
https://issues.apache.org/jira/browse/DERBY-7108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17867577#comment-17867577
]
Qiheng He commented on DERBY-7108:
----------------------------------
- While investigating https://issues.apache.org/jira/browse/DERBY-7165 , I also
ran unit tests for Embedded Derby under GraalVM Native Image. I also saw the
problem described in the current issue. But to be honest, considering the
closed world assumption of GraalVM Native Image, dynamic class loaders are
unlikely to be implemented in the future. Feel free to test
https://github.com/linghengqian/derby-network-server-jdk22-test on *Ubuntu
22.04.4* with *SDKMAN!* .
{code:bash}
sdk install java 22.0.2-graalce
sdk use java 22.0.2-graalce
sudo apt-get install build-essential zlib1g-dev -y
git clone [email protected]:linghengqian/derby-network-server-jdk22-test.git
cd ./derby-network-server-jdk22-test/
git reset --hard 0c94685ea74d87a73fca9401a6cb1c909d9f74c9
./mvnw -PgenerateMetadata -DskipNativeTests -e -T1C clean test
native:metadata-copy
./mvnw -PnativeTestInJunit -T1C -e clean test
{code}
- Obviously I get the Error Log.
{code:bash}
JUnit Platform on Native Image - report
----------------------------------------
14:04:19.511 [main] DEBUG com.zaxxer.hikari.HikariConfig - Driver class
org.apache.derby.jdbc.EmbeddedDriver not found in Thread context class loader
jdk.internal.loader.ClassLoaders$AppClassLoader@e580929, trying classloader
jdk.internal.loader.ClassLoaders$AppClassLoader@e580929
14:04:19.511 [main] ERROR com.zaxxer.hikari.HikariConfig - Failed to load
driver class org.apache.derby.jdbc.EmbeddedDriver from HikariConfig class
classloader jdk.internal.loader.ClassLoaders$AppClassLoader@e580929
com.lingh.DerbyTest > testDerbyNetworkServer() SKIPPED: void
com.lingh.DerbyTest.testDerbyNetworkServer() is @Disabled
com.lingh.DerbyTest > testEmbeddedDerby() FAILED
Failures (1):
JUnit Jupiter:DerbyTest:testEmbeddedDerby()
MethodSource [className = 'com.lingh.DerbyTest', methodName =
'testEmbeddedDerby', methodParameterTypes = '']
=> org.opentest4j.AssertionFailedError: Unexpected exception thrown:
java.lang.RuntimeException: Failed to load driver class
org.apache.derby.jdbc.EmbeddedDriver in either of HikariConfig class loader or
Thread context classloader
org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152)
org.junit.jupiter.api.AssertDoesNotThrow.createAssertionFailedError(AssertDoesNotThrow.java:84)
org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:53)
org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:36)
org.junit.jupiter.api.Assertions.assertDoesNotThrow(Assertions.java:3168)
[...]
Caused by: java.lang.RuntimeException: Failed to load driver class
org.apache.derby.jdbc.EmbeddedDriver in either of HikariConfig class loader or
Thread context classloader
com.zaxxer.hikari.HikariConfig.setDriverClassName(HikariConfig.java:494)
com.lingh.DerbyTest.lambda$testEmbeddedDerby$0(DerbyTest.java:24)
org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:49)
[...]
Test run finished after 5 ms
[ 2 containers found ]
[ 0 containers skipped ]
[ 2 containers started ]
[ 0 containers aborted ]
[ 2 containers successful ]
[ 0 containers failed ]
[ 2 tests found ]
[ 1 tests skipped ]
[ 1 tests started ]
[ 0 tests aborted ]
[ 0 tests successful ]
[ 1 tests failed ]
{code}
- Maybe there is nothing to be done about the current issue unless the relevant
logic is refactored to avoid using dynamic class loaders.
> Make derby graalvm friendly
> ---------------------------
>
> Key: DERBY-7108
> URL: https://issues.apache.org/jira/browse/DERBY-7108
> Project: Derby
> Issue Type: Task
> Affects Versions: 10.16.1.1
> Reporter: Romain Manni-Bucau
> Priority: Major
> Attachments: outs.zip
>
>
> Hi,
> It would be neat to be able to use derby embedded with graalvm.
> Some work started at [https://github.com/apache/geronimo-arthur/tree/openjpa]
> (see [https://www.mail-archive.com/[email protected]/msg97748.html)]
> but I faced some weird issue about derby context.
> Wonder how derby community considers graalvm (h2 for example explicitly said
> it will never care about it and is happy with having broken graal support in
> a minor version which is their choice but also means there is no point
> integrating it since work can be to redo for each minor).
> If you are interested I'm happy to collaborate if needed to try to make it
> supported through arthur or native native-image configuration (can sit in the
> derby jar to work OOTB too).
> Side note: if it helps we can chat on asf slack.
> Romain
--
This message was sent by Atlassian Jira
(v8.20.10#820010)