-
-
Notifications
You must be signed in to change notification settings - Fork 808
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
No classes have been predefined during the image build to load from bytecodes at runtime #1588
Comments
Are the created classes really added? It seems like they are missing from the application. |
According to my code and config file, it should be added, can you tell me which class information is missing? Theoretically the tracing agent should be able to catch it, I didn't manually intervene because it must have loaded the relevant class when it started, so it should be traced. |
|
Failures (1):
JUnit Jupiter:SeataTest:assertShardingInSeataTransactions()
MethodSource [className = 'com.lingh.SeataTest', methodName = 'assertShardingInSeataTransactions', methodParameterTypes = '']
=> com.oracle.svm.core.jdk.UnsupportedFeatureError: Defining a class from new bytecodes at run time is not supported. Class io.seata.config.Configuration$io$seata$config$ConfigurationCache$proxy$ByteBuddy with hash 0d95147338eda0009d73dad94a7c7818120e44e6bdb18007c807001b7adba0fb was not provided during the image build. Please see BuildConfiguration.md.
org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:121)
org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:136)
[email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:280)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.access$300(ByteArrayClassLoader.java:56)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader$ClassDefinitionAction.run(ByteArrayClassLoader.java:686)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader$ClassDefinitionAction.run(ByteArrayClassLoader.java:638)
[email protected]/java.security.AccessController.executePrivileged(AccessController.java:129)
[email protected]/java.security.AccessController.doPrivileged(AccessController.java:400)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.doPrivileged(ByteArrayClassLoader.java)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.findClass(ByteArrayClassLoader.java:405)
[...]
Test run finished after 5560 ms
[ 2 containers found ]
[ 0 containers skipped ]
[ 2 containers started ]
[ 0 containers aborted ]
[ 2 containers successful ]
[ 0 containers failed ]
[ 1 tests found ]
[ 0 tests skipped ]
[ 1 tests started ]
[ 0 tests aborted ]
[ 0 tests successful ]
[ 1 tests failed ]
|
Byte Buddy tries to provide different defaults when it detects Graal: |
Args = -H:ClassInitialization=net.bytebuddy.ClassFileVersion:rerun \
-H:ClassInitialization=net.bytebuddy.utility.dispatcher.JavaDispatcher:rerun \
-H:ClassInitialization=net.bytebuddy.utility.Invoker$Dispatcher:rerun \
-H:ClassInitialization=net.bytebuddy.utility.GraalImageCode:rerun \
--initialize-at-build-time=net.bytebuddy.description.method.MethodDescription$InDefinedShape$AbstractBase$ForLoadedExecutable \
--initialize-at-build-time=net.bytebuddy.description.type.TypeDescription$AbstractBase \
--initialize-at-build-time=net.bytebuddy.description.type.TypeDescription$ForLoadedType \
--initialize-at-build-time=net.bytebuddy.description.method.MethodDescription$ForLoadedMethod \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$1 \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$2 \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Super$Instantiation$2 \
--initialize-at-build-time=net.bytebuddy.utility.dispatcher.JavaDispatcher$DynamicClassLoader
========================================================================================================================
GraalVM Native Image: Generating 'native-tests' (executable)...
========================================================================================================================
[1/8] Initializing... (7.1s @ 0.33GB)
Java version: 21.0.2+13, vendor version: GraalVM CE 21.0.2+13.1
Graal compiler: optimization level: b, target machine: x86-64-v3
C compiler: gcc (linux, x86_64, 11.4.0)
Garbage collector: Serial GC (max heap size: 80% of RAM)
2 user-specific feature(s):
- com.oracle.svm.thirdparty.gson.GsonFeature
- org.graalvm.junit.platform.JUnitPlatformFeature
------------------------------------------------------------------------------------------------------------------------
1 experimental option(s) unlocked:
- '-H:ClassInitialization' (alternative API option(s): --initialize-at-run-time=net.bytebuddy.ClassFileVersion:rerun, --initialize-at-run-time=net.bytebuddy.utility.dispatcher.JavaDispatcher:rerun, --initialize-at-run-time=net.bytebuddy.utility.Invoker$Dispatcher:rerun, --initialize-at-run-time=net.bytebuddy.utility.GraalImageCode:rerun, --initialize-at-run-time=net.bytebuddy.description.method.MethodDescription$InDefinedShape$AbstractBase$ForLoadedExecutable:build_time, --initialize-at-run-time=net.bytebuddy.description.type.TypeDescription$AbstractBase:build_time, --initialize-at-run-time=net.bytebuddy.description.type.TypeDescription$ForLoadedType:build_time, --initialize-at-run-time=net.bytebuddy.description.method.MethodDescription$ForLoadedMethod:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$1:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$2:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Super$Instantiation$2:build_time, --initialize-at-run-time=net.bytebuddy.utility.dispatcher.JavaDispatcher$DynamicClassLoader:build_time, --initialize-at-run-time=net.bytebuddy.ClassFileVersion:rerun, --initialize-at-run-time=net.bytebuddy.utility.dispatcher.JavaDispatcher:rerun, --initialize-at-run-time=net.bytebuddy.utility.Invoker$Dispatcher:rerun, --initialize-at-run-time=net.bytebuddy.utility.GraalImageCode:rerun, --initialize-at-run-time=net.bytebuddy.description.method.MethodDescription$InDefinedShape$AbstractBase$ForLoadedExecutable:build_time, --initialize-at-run-time=net.bytebuddy.description.type.TypeDescription$AbstractBase:build_time, --initialize-at-run-time=net.bytebuddy.description.type.TypeDescription$ForLoadedType:build_time, --initialize-at-run-time=net.bytebuddy.description.method.MethodDescription$ForLoadedMethod:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$1:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$2:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Super$Instantiation$2:build_time, --initialize-at-run-time=net.bytebuddy.utility.dispatcher.JavaDispatcher$DynamicClassLoader:build_time, --initialize-at-run-time=io.netty.handler.codec.compression.BrotliDecoder:run_time; origin(s): 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/target/test-classes/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/target/test-classes/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/target/test-classes/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/target/test-classes/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/src/test/resources/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/src/test/resources/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/src/test/resources/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/src/test/resources/')
------------------------------------------------------------------------------------------------------------------------
Build resources:
- 8.82GB of memory (45.1% of 19.54GB system memory, determined at start)
- 16 thread(s) (100.0% of 16 available processor(s), determined at start)
Skipped 221 predefined class(es) because the classpath already contains a class with the same name: io.seata.sqlparser.druid.polardbx.PolarDBXOperateRecognizerHolder, com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGSQLStatement, com.alibaba.druid.sql.dialect.phoenix.parser.PhoenixExprParser, com.alibaba.druid.sql.dialect.sqlserver.visitor.SQLServerASTVisitor, com.alibaba.druid.sql.ast.SQLPartitionByValue, com.alibaba.druid.sql.dialect.h2.visitor.H2ASTVisitor, com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGUpdateStatement, com.alibaba.druid.sql.dialect.postgresql.parser.PGLexer, com.alibaba.druid.sql.ast.SQLIndex, com.alibaba.druid.sql.ast.SQLDataType, ...
[junit-platform-native] Running in 'test listener' mode using files matching pattern [junit-platform-unique-ids*] found in folder [/home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/target/test-ids] and its subfolders.
[2/8] Performing analysis... [*] (27.5s @ 2.47GB)
20,712 reachable types (87.6% of 23,656 total)
34,579 reachable fields (60.1% of 57,511 total)
105,293 reachable methods (58.9% of 178,652 total)
6,881 types, 1,852 fields, and 7,013 methods registered for reflection
Error: Classes that should be initialized at run time got initialized during image building:
net.bytebuddy.utility.OpenedClassReader was unintentionally initialized at build time. To see why net.bytebuddy.utility.OpenedClassReader got initialized use --trace-class-initialization=net.bytebuddy.utility.OpenedClassReader
To see how the classes got initialized, use --trace-class-initialization=net.bytebuddy.utility.OpenedClassReader
------------------------------------------------------------------------------------------------------------------------
3.8s (10.5% of total time) in 51 GCs | Peak RSS: 5.44GB | CPU load: 9.66
========================================================================================================================
Finished generating 'native-tests' in 35.1s.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 48.480 s (Wall Clock)
[INFO] Finished at: 2024-02-19T22:19:35+08:00
[INFO] ------------------------------------------------------------------------
|
Maybe it's another |
Args = -H:ClassInitialization=net.bytebuddy.ClassFileVersion:rerun \
-H:ClassInitialization=net.bytebuddy.utility.dispatcher.JavaDispatcher:rerun \
-H:ClassInitialization=net.bytebuddy.utility.Invoker$Dispatcher:rerun \
-H:ClassInitialization=net.bytebuddy.utility.GraalImageCode:rerun \
--initialize-at-build-time=net.bytebuddy.description.method.MethodDescription$InDefinedShape$AbstractBase$ForLoadedExecutable \
--initialize-at-build-time=net.bytebuddy.description.type.TypeDescription$AbstractBase \
--initialize-at-build-time=net.bytebuddy.description.type.TypeDescription$ForLoadedType \
--initialize-at-build-time=net.bytebuddy.description.method.MethodDescription$ForLoadedMethod \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$1 \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$2 \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Super$Instantiation$2 \
--initialize-at-build-time=net.bytebuddy.utility.dispatcher.JavaDispatcher$DynamicClassLoader \
-H:ClassInitialization=net.bytebuddy.utility.OpenedClassReader:rerun
Failures (1):
JUnit Jupiter:SeataTest:assertShardingInSeataTransactions()
MethodSource [className = 'com.lingh.SeataTest', methodName = 'assertShardingInSeataTransactions', methodParameterTypes = '']
=> com.oracle.svm.core.jdk.UnsupportedFeatureError: Defining a class from new bytecodes at run time is not supported. Class io.seata.config.Configuration$io$seata$config$ConfigurationCache$proxy$ByteBuddy with hash db8f83740bdb05f4253fbf0991a7136955934bc498167aebbe1869a3d170eb8f was not provided during the image build. Please see BuildConfiguration.md.
org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:121)
org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:136)
[email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:280)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.access$300(ByteArrayClassLoader.java:56)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader$ClassDefinitionAction.run(ByteArrayClassLoader.java:686)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader$ClassDefinitionAction.run(ByteArrayClassLoader.java:638)
[email protected]/java.security.AccessController.executePrivileged(AccessController.java:129)
[email protected]/java.security.AccessController.doPrivileged(AccessController.java:400)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.doPrivileged(ByteArrayClassLoader.java)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.findClass(ByteArrayClassLoader.java:405)
[...]
Test run finished after 6586 ms
[ 2 containers found ]
[ 0 containers skipped ]
[ 2 containers started ]
[ 0 containers aborted ]
[ 2 containers successful ]
[ 0 containers failed ]
[ 1 tests found ]
[ 0 tests skipped ]
[ 1 tests started ]
[ 0 tests aborted ]
[ 0 tests successful ]
[ 1 tests failed ]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:35 min (Wall Clock)
[INFO] Finished at: 2024-02-20T16:34:23+08:00
[INFO] ------------------------------------------------------------------------
|
Having said that, opening this issue does not really help. After all, seata has removed the call to bytebuddy, so it can now compile to graalvm native image normally. |
-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image
I have used the tracing agent to generate all the required classes, but finally this exception is thrown when executing the executable file
The text was updated successfully, but these errors were encountered: