Affects: v6.2.0-RC1

Classes (may be incomplete, but these two were sufficient for working send/receive example via JMS queue)

  • org.springframework.jms.connection.SingleConnectionFactory
  • org.springframework.jms.connection.CachingConnectionFactory

use JDK proxies to obtain jakarta.jms.Connection and org.springframework.jms.connection.SessionProxy, among others, but there are no native image hints, so any attempt to send/receive a JMS message in native-image will fail with exceptions similar to one below

org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access the proxy class inheriting [org.springframework.jms.connection.SessionProxy, jakarta.jms.QueueSession, jakarta.jms.TopicSession] without it being registered for runtime reflection. Add [org.springframework.jms.connection.SessionProxy, jakarta.jms.QueueSession, jakarta.jms.TopicSession] to the dynamic-proxy metadata to solve this problem. Note: The order of interfaces used to create proxies matters. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#dynamic-proxy for help.
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils.forProxy(MissingReflectionRegistrationUtils.java:89)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.proxy.DynamicProxySupport.getProxyClass(DynamicProxySupport.java:176)
        at java.base@21.0.4/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:47)
        at java.base@21.0.4/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1034)
        at org.springframework.jms.connection.CachingConnectionFactory.getCachedSessionProxy(CachingConnectionFactory.java:289)
        at org.springframework.jms.connection.CachingConnectionFactory.getSession(CachingConnectionFactory.java:267)
        at org.springframework.jms.connection.SingleConnectionFactory$SharedConnectionInvocationHandler.invoke(SingleConnectionFactory.java:741)

I was able to capture and create proxy-config.json using graalvm native agent but as far as I know, native image hints are provided by META-INF/spring/aot.factories and/or org.springframework.aot.hint.RuntimeHintsRegistrar

Please find a reproducer here: https://github.com/krezovic/artemis-native-demo - branch "bugreport" ... "main" branch contains the proxy hints file

Run it with:

./start-artemis-docker.sh
./mvnw clean package -P native
./mvnw native:compile-no-fork
./target/artemis-native-demo

If adding of native image hints is responsibility of spring-boot, then please let me know and I will move the issue accordingly.

Comment From: bclozel

Thanks for the report @krezovic ! The proxies hints will be generated as of now. I see that you're running with many other hints for the artemis library. You might want to contribute those to the library directly or in the reachability metadata repository for better integration maybe?

Comment From: krezovic

Thanks for the fix.

I tried contributing the hints file, but I can't get used to gradle build they use so I got lost and simply dropped it. Plus, I use docker for hints file generation and testing and they have tedious docker image approval process that I don't really want to go through.

Not sure how I would go using artemis-jakarta-server via TCP/Netty/whatever ... I tried with spring.artemis.mode=embedded and I didn't get the right hints for spring.artemis.mode=native ... as expected.

If anyone wants to contribute the data back to them, you are welcome and have my permission.