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

Support GraalVM native images #963

Open
joshlong opened this issue Oct 3, 2022 · 1 comment
Open

Support GraalVM native images #963

joshlong opened this issue Oct 3, 2022 · 1 comment

Comments

@joshlong
Copy link

joshlong commented Oct 3, 2022

Hello,

I'm trying to make the spring integration mqtt support work in a GraalVM native image context. It breaks in eclipse paho's amazing (thank you for the good work) mqtt client as there some places where reflection is required and where resources are loaded from the classpath.

I originally submitted some proposed changes to the spring integration project but they wisely forwarded me here to you.

Here's the original issue:

spring-projects/spring-integration#3900

GraalVM will look for .json Config files in the META-INF/native-image/ of all jars it finds on the classpath. You could ship those with no code changes and help me get at least my example working.

I link to some code in the Spring Integration issue to which I've linked you that programmatically contributes the configurations my app needed to work in a GraalVM native image context. It would be straightforward to translate that into static .json files and add those to your project. I might give it a go myself...

Thanks for your work and for your consideration

@artembilan
Copy link

This is what we see so far as working native configs:

  1. resource-config.json
{
  "bundles": [
    {
      "name": "org\/eclipse\/paho\/client\/mqttv3\/internal\/nls\/messages"
    },
    {
      "name": "org\/eclipse\/paho\/client\/mqttv3\/internal\/nls\/logcat"
    },
    {
      "name": "org\/eclipse\/paho\/mqttv5\/common\/nls\/messages"
    },
    {
      "name": "org\/eclipse\/paho\/mqttv5\/client\/internal\/nls\/logcat"
    }
  ]
}
  1. reflect-config.json:
[
  {
    "name": "org.eclipse.paho.client.mqttv3.logging.JSR47Logger",
    "allPublicConstructors": true
  },
  {
    "name": "org.eclipse.paho.mqttv5.client.logging.JSR47Logger",
    "allPublicConstructors": true
  }
]

Although v3 and v5 stuff definitely must be devided between respective modules in this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants