-
Notifications
You must be signed in to change notification settings - Fork 25
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
GraalVM Native Image fails creating AMQP10JMSConnectionFactoryFactory #14
Comments
You example doesn't appear to have any way to run / validate it |
My example:
Native execution, linux:
|
Ran the example using the given " java -jar .\target\test-amqp-10-jms-1.0-SNAPSHOT.jar" and it works without issue, not other details were given on how it is being run to generate the error. |
The error generates when i run the native image, a linux binary created using Graalvm native-image. |
Link doesn't really provide any easy steps for me to follow with the limited time I have to look at this so not much I can do but I'd doubt even if the needed graalvm metadata was added to make the JmsConnectionFactory visible that it would works as Qpid JMS uses extensive refection code under the covers for configuring the client. You could use something like Quarkus Qpid JMS which has the added work to get native mode working along with documentation that shows how to build it in native made. |
You need a Linux machine and install Graalvm from https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java19-linux-amd64-22.3.1.tar.gz
Check that your java_home points to the Graalvm installation
With this, you have everything ready to perform the native compilation. Now you just have to run maven to do the native build.
This generates a linux executable binary, as you can see
The binary file is test-amqp-10-jms. [root@fedora]# ./target/test-amqp-10-jms
|
I am perfectly aware of the option to use Quarkus, but what I would need is for this library (https://github.com/amqphub/amqp-10-jms-spring-boot) to work for spring boot native as well, without the need to create custom hints or other workarounds. |
With the info provided I was able to build and reproduce the issue. I went ahead and created a reflect-config.json that gets you past the initial problem but as I expected you just run into other issue as Qpid JMS doesn't support being built as a native mode library so you just get different errors as it tries to start. I don't see there being scope to try and figure out how to add enough configuration here to get it working. Contributions are welcome. |
As an initial workaround, I've added this annotation, @RegisterReflectionForBinding({JmsTemplate.class, JmsConnectionFactory.class}), to the App class and for this simple example it works. On the other hand, I have used the Tracing Agent (https://www.graalvm.org/22.0/reference-manual/native-image/Agent/) in a more complex project, which uses amqp-10-jms-spring-boot -starter, and I have this from the reflect-config.json file that is generated:
|
I added a basic reflect config as a start that gets your simple example to build and run without an error. I did not actually test client functionality |
I updated the reflection config and added resource config which now allows me to start a sample spring boot project build into a native image and connect to a broker. The application ultimately fails though due to spring boot trying to create a proxy that cannot be done in native applications and I can't figure out how to stop it doing that or configure it to work (proxybeanmethods = false) didn't work. |
AMQP10JMSConnectionFactoryFactory is using reflection to create a connection factory, therefore for example a spring boot application using amqp-10-jms-spring-boot-starter, compiled using Graalvm native image does not run correctly.
The library should provide Graal metadata that enables the necessary reflection.
You can see the source code of a example application at https://github.com/luidoc/test-amqp-10-jms.git
The text was updated successfully, but these errors were encountered: