GithubHelp home page GithubHelp logo

Comments (8)

raphw avatar raphw commented on July 21, 2024

Are the created classes really added? It seems like they are missing from the application.

from byte-buddy.

funky-eyes avatar funky-eyes commented on July 21, 2024

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.

from byte-buddy.

linghengqian avatar linghengqian commented on July 21, 2024
  • I'm happy to assume this involves a bug on the GraalVM CE side, which I've opened oracle/graal#8396.
  • Discuss two situations,
    • Carrying experimental-class-define-support=true generates GraalVM Reachability Metadata in Conditional form, which will cause exceptions.
    • Carrying experimental-class-define-support=true generates GraalVM Reachability Metadata in Standard form, which always works.
    • image

from byte-buddy.

linghengqian avatar linghengqian commented on July 21, 2024
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          ]

from byte-buddy.

raphw avatar raphw commented on July 21, 2024

Byte Buddy tries to provide different defaults when it detects Graal: GraalImageCode, but possibly those defaults are overridden. In this case you need to contact the library maintainers. Maybe you can initiate the Graal support explicitly, too.

from byte-buddy.

linghengqian avatar linghengqian commented on July 21, 2024
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] ------------------------------------------------------------------------

from byte-buddy.

raphw avatar raphw commented on July 21, 2024

Maybe it's another -H:ClassInitialization that needs to be added? To be perfectly honest, I never fully understood what is going on with these options and just kept adding them until everything worked.

from byte-buddy.

linghengqian avatar linghengqian commented on July 21, 2024
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] ------------------------------------------------------------------------

from byte-buddy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.