Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom ClassLoader behaves differently under JVM and Native Image #5913

Open
linghengqian opened this issue Feb 7, 2023 · 2 comments
Open
Assignees

Comments

@linghengqian
Copy link

Describe the issue
A clear and concise description of the issue. We recommend using the latest snapshot builds to replicate the issue as bugs are constantly being fixed in the master branch

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. [e.g.: git clone --depth 1 https://git.myrepo.com/projectone ]
  2. [e.g.: mvn clean package]
sudo apt install unzip zip curl sed -y
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install java 22.3.1.r17-grl
sdk use java 22.3.1.r17-grl

gu install native-image
sudo apt-get install build-essential libz-dev zlib1g-dev -y

git clone [email protected]:linghengqian/driver-classloader-graalvm-test.git
cd ./driver-classloader-graalvm-test/
./gradlew -Pagent clean test
./gradlew metadataCopy --task test
./gradlew clean nativeTest

Describe GraalVM and your environment:

  • GraalVM version (latest snapshot builds can be found here), or commit id if built from source: [e.g. EE 19.3, CE 20.0, CE 20.1.0-dev-20200304_0848] CE 22.3.1
  • JDK major version: [e.g.:8] 17
  • OS: [e.g. macOS Catalina] Ubuntu 22.04
  • Architecture: [e.g.: AMD64] AMD64

More details
Consider adding the --native-image-info and --verbose flags when building your native image and paste output below.

Add any other information about the problem here. Especially important are stack traces or log output. Feel free to link to gists or to screenshots if necessary.

> Task :nativeTest
JUnit Platform on Native Image - report
----------------------------------------

org.apache.commons.dbcp2.TestBasicDataSource > testThreaded() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testCanCloseStatementTwice() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testNoRsetClose() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testOpening() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testCanCloseConnectionTwice() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testIsClosed() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testCanCloseCallableStatementTwice() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testAutoCommitBehavior() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testHashing() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testCanClosePreparedStatementTwice() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testClosing() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testPrepareStatementOptions() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testBackPointers() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testHashCode() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testConnectionsAreDistinct() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testMaxTotal() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testRepeatedBorrowAndReturn() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testCanCloseResultSetTwice() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testClearWarnings() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testSimple2() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testSimple() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testPooling() SUCCESSFUL

org.apache.commons.dbcp2.TestBasicDataSource > testDriverClassLoader() FAILED


Failures (1):
  JUnit Jupiter:TestBasicDataSource:testDriverClassLoader()
    MethodSource [className = 'org.apache.commons.dbcp2.TestBasicDataSource', methodName = 'testDriverClassLoader', methodParameterTypes = '']
    => org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
       org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
       org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
       org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
       org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
       org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
       org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:180)
       org.apache.commons.dbcp2.TestBasicDataSource.testDriverClassLoader(TestBasicDataSource.java:67)
       [email protected]/java.lang.reflect.Method.invoke(Method.java:568)
       org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
       org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
       [...]

Test run finished after 2828 ms
[         2 containers found      ]
[         0 containers skipped    ]
[         2 containers started    ]
[         0 containers aborted    ]
[         2 containers successful ]
[         0 containers failed     ]
[        23 tests found           ]
[         0 tests skipped         ]
[        23 tests started         ]
[         0 tests aborted         ]
[        22 tests successful      ]
[         1 tests failed          ]


> Task :nativeTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':nativeTest'.
> Process 'command '/home/linghengqian/TwinklingLiftWorks/git/public/driver-classloader-graalvm-test/build/native/nativeTestCompile/driver-classloader-graalvm-test-tests'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 14s
8 actionable tasks: 8 executed
@oubidar-Abderrahim
Copy link
Member

Hi, Thank you for reporting this, we will take a look into it shortly

@oubidar-Abderrahim
Copy link
Member

Tracked internally on GR 44508

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants