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

RocketMQ Client can't run in GraalVM environment #5835

Open
steverao opened this issue Jan 6, 2023 · 6 comments
Open

RocketMQ Client can't run in GraalVM environment #5835

steverao opened this issue Jan 6, 2023 · 6 comments

Comments

@steverao
Copy link

steverao commented Jan 6, 2023

Which Component
eg. RocketMQ

Describe what problem you have encountered
RocketMQ Client support run in GraalVM environment. it can't run now. You can reproduce this issue by following these steps:
Prerequisites Start RocketMQ broker and nameserver

  1. Download the Spring Cloud Alibaba project, switch to the 2022.x branch, enter the rocketmq-broadcast-producer-example module, enter the pom.xml file, add below dependency and plugin.
<dependency>
   <groupId>com.alibaba</groupId>
   <artifactId>fastjson</artifactId>
   <version>2.0.22</version>
</dependency>

<plugin>
 <groupId>org.graalvm.buildtools</groupId>
 <artifactId>native-maven-plugin</artifactId>
 <configuration>
   <classesDirectory>${project.build.outputDirectory}</classesDirectory>
   <metadataRepository>
     <enabled>true</enabled>
   </metadataRepository>
   <requiredVersion>22.3</requiredVersion>
   <buildArgs>
     --initialize-at-build-time=org.apache.commons.logging.LogFactoryService
   </buildArgs>
 </configuration>
 <executions>
   <execution>
     <id>add-reachability-metadata</id>
     <goals>
       <goal>add-reachability-metadata</goal>
     </goals>
   </execution>
 </executions>
</plugin>
  1. Execute mvn clean -Pnative spring-boot:run. After the application starts, it will scan the code dynamic properties. After about 10 seconds, stop the application through control+C, and there will be a META-INF.native in the resources directory. image directory, there will be a static configuration file corresponding to the dynamic properties of the code below. You need to enter the reflect-config.json file to delete the corresponding item of org.springframework.integration.config.ConverterRegistrar$IntegrationConverterRegistration.
  2. Execute mvn clean -Pnative native:compile to build the native image. If it goes well, it will be built successfully, and then target/rocketmq-broadcast-producer-example should start the application and the problem should be reproduced.
    image
@ShadowySpirits
Copy link
Member

It seems like your client can not connect to the nameserver. Please try nc 127.0.0.1 9876 -zv to check if the nameserver is running.

@steverao
Copy link
Author

steverao commented Jan 6, 2023

It seems like your client can not connect to the nameserver. Please try nc 127.0.0.1 9876 -zv to check if the nameserver is running.

No, I confirm that the nameserver and broker is running, I can send message in general method.

@lizhanhui
Copy link
Contributor

@steverao The auto-scan of the reflection classes should be incomplete, check out the log output, there should be some ClassNotFound exceptions raised.

@lizhimins
Copy link
Member

Check the client log

@steverao
Copy link
Author

ClassNotFound

yes, there are a lot of relevant ClassNotFound warning logs when I use mvn clean -Pnative native:compile to compile the demo, it's hard to find which one cause the sending message error. Do you have any suggestion to help me solve it?
image

@ouyanggan
Copy link

hello,man I have same problem with you ,Do you have solve your problem?

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

6 participants