linghengqian opened a new pull request, #30778:
URL: https://github.com/apache/shardingsphere/pull/30778

   Fixes #30552.
   
   Changes proposed in this pull request:
     - Support building ShardingSphere and its corresponding GraalVM Native 
Image through JDK 22.
     - Due to Truffle Unchained, the new version of GraalVM Truffle can still 
be used on GraalVM For JDK21. Reference 
https://medium.com/graalvm/whats-new-in-truffle-and-graal-languages-40027a59c401
 .
     - Because the `--strict-image-heap` parameter mentioned in 
https://github.com/oracle/graal/blob/vm-24.0.0/substratevm/CHANGELOG.md is 
enabled by default, GraalVM Reachability Metadata entries for third-party 
dependencies such as `com.ctc.wstx.stax.**` start to be recorded, and these 
JSON entries should be excluded. `reflect-config.json` also requires adding 
some new JSON entries due to the use of this parameter. Otherwise there is an 
Error Log.
   ```shell
   [ERROR] 2024-04-05 03:48:05.929 [Etcd-EventListener-0] 
o.a.s.m.r.c.etcd.EtcdRepository - Dispatch event failed
   java.util.concurrent.CompletionException: 
org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried 
to reflectively invoke method
   
      public synchronized void 
org.apache.shardingsphere.mode.manager.cluster.coordinator.subscriber.ResourceMetaDataChangedSubscriber.renew(org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.metadata.event.SchemaAddedEvent)
   
    without it being registered for runtime reflection. Add public synchronized 
void 
org.apache.shardingsphere.mode.manager.cluster.coordinator.subscriber.ResourceMetaDataChangedSubscriber.renew(org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.metadata.event.SchemaAddedEvent)
 to the reflection metadata to solve this problem. See 
https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection
 for help.
           at 
java.base@22/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
           at 
java.base@22/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
           at 
java.base@22/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1807)
           at 
java.base@22/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
           at 
java.base@22/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
           at java.base@22/java.lang.Thread.runWith(Thread.java:1583)
           at java.base@22/java.lang.Thread.run(Thread.java:1570)
           at 
org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:853)
           at 
org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:829)
   Caused by: org.graalvm.nativeimage.MissingReflectionRegistrationError: The 
program tried to reflectively invoke method
   
      public synchronized void 
org.apache.shardingsphere.mode.manager.cluster.coordinator.subscriber.ResourceMetaDataChangedSubscriber.renew(org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.metadata.event.SchemaAddedEvent)
   
    without it being registered for runtime reflection. Add public synchronized 
void 
org.apache.shardingsphere.mode.manager.cluster.coordinator.subscriber.ResourceMetaDataChangedSubscriber.renew(org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.metadata.event.SchemaAddedEvent)
 to the reflection metadata to solve this problem. See 
https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection
 for help.
           at 
org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils.forQueriedOnlyExecutable(MissingReflectionRegistrationUtils.java:74)
           at 
java.base@22/java.lang.reflect.Method.acquireMethodAccessor(Method.java:77)
           at java.base@22/java.lang.reflect.Method.invoke(Method.java:577)
           at 
com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:85)
           at 
com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:142)
           at 
com.google.common.eventbus.Subscriber.lambda$dispatchEvent$0(Subscriber.java:71)
           at 
com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:31)
           at 
com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:68)
           at 
com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:109)
           at com.google.common.eventbus.EventBus.post(EventBus.java:270)
           at 
org.apache.shardingsphere.infra.util.eventbus.EventBusContext.post(EventBusContext.java:51)
           at java.base@22/java.util.Optional.ifPresent(Optional.java:178)
           at 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.GovernanceWatcherFactory.lambda$watch$0(GovernanceWatcherFactory.java:55)
           at 
org.apache.shardingsphere.mode.repository.cluster.etcd.EtcdRepository.lambda$dispatchEvent$3(EtcdRepository.java:184)
           at 
java.base@22/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
           ... 6 common frames omitted
   [ERROR] 2024-04-05 03:48:07.007 [Curator-SafeNotifyService-0] 
o.a.c.f.l.MappingListenerManager - Listener 
(org.apache.curator.framework.recipes.cache.CuratorCacheListenerBuilderImpl$2@362b7797)
 threw an exception
   org.graalvm.nativeimage.MissingReflectionRegistrationError: The program 
tried to reflectively invoke method
   
      public synchronized void 
org.apache.shardingsphere.mode.manager.cluster.coordinator.subscriber.ResourceMetaDataChangedSubscriber.renew(org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.metadata.event.SchemaAddedEvent)
   
    without it being registered for runtime reflection. Add public synchronized 
void 
org.apache.shardingsphere.mode.manager.cluster.coordinator.subscriber.ResourceMetaDataChangedSubscriber.renew(org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.metadata.event.SchemaAddedEvent)
 to the reflection metadata to solve this problem. See 
https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection
 for help.
           at 
org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils.forQueriedOnlyExecutable(MissingReflectionRegistrationUtils.java:74)
           at 
java.base@22/java.lang.reflect.Method.acquireMethodAccessor(Method.java:77)
           at java.base@22/java.lang.reflect.Method.invoke(Method.java:577)
           at 
com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:85)
           at 
com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:142)
           at 
com.google.common.eventbus.Subscriber.lambda$dispatchEvent$0(Subscriber.java:71)
           at 
com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:31)
           at 
com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:68)
           at 
com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:109)
           at com.google.common.eventbus.EventBus.post(EventBus.java:270)
           at 
org.apache.shardingsphere.infra.util.eventbus.EventBusContext.post(EventBusContext.java:51)
           at java.base@22/java.util.Optional.ifPresent(Optional.java:178)
           at 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.GovernanceWatcherFactory.lambda$watch$0(GovernanceWatcherFactory.java:55)
           at 
org.apache.shardingsphere.mode.repository.cluster.zookeeper.ZookeeperRepository.lambda$watch$0(ZookeeperRepository.java:251)
           at 
org.apache.curator.framework.recipes.cache.TreeCacheListenerWrapper.sendEvent(TreeCacheListenerWrapper.java:61)
           at 
org.apache.curator.framework.recipes.cache.TreeCacheListenerWrapper.event(TreeCacheListenerWrapper.java:37)
           at 
org.apache.curator.framework.recipes.cache.CuratorCacheListenerBuilderImpl$2.lambda$event$0(CuratorCacheListenerBuilderImpl.java:128)
           at java.base@22/java.util.ArrayList.forEach(ArrayList.java:1597)
           at 
org.apache.curator.framework.recipes.cache.CuratorCacheListenerBuilderImpl$2.event(CuratorCacheListenerBuilderImpl.java:128)
           at 
org.apache.curator.framework.recipes.cache.CuratorCacheImpl.lambda$putStorage$7(CuratorCacheImpl.java:238)
           at 
org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:82)
           at 
org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:80)
           at 
org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:81)
           at 
org.apache.curator.framework.recipes.cache.CuratorCacheImpl.lambda$callListeners$10(CuratorCacheImpl.java:249)
           at 
java.base@22/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
           at 
java.base@22/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
           at 
java.base@22/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
           at java.base@22/java.lang.Thread.runWith(Thread.java:1583)
           at java.base@22/java.lang.Thread.run(Thread.java:1570)
           at 
org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:853)
           at 
org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:829)
   ```
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following 
options:
   - [x] My code follows the [code of 
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) 
of this project.
   - [x] I have self-reviewed the commit code.
   - [x] I have (or in comment I request) added corresponding labels for the 
pull request.
   - [x] I have passed maven check locally : `./mvnw clean install -B -T1C 
-Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [x] I have made corresponding changes to the documentation.
   - [ ] I have added corresponding unit tests for my changes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to