Hey folks, I am trying to bump the dependencies for aws-api-s3 I am able to generate the image but when I run the binary I am getting:
Exception in thread "main" clojure.lang.ExceptionInfo: Cannot find resource cognitect/aws/s3/service.edn. {}
at cognitect.aws.service$service_description.invokeStatic(service.clj:32)
at cognitect.aws.service$service_description.invoke(service.clj:29)
at cognitect.aws.client.api$client.invokeStatic(api.clj:73)
at cognitect.aws.client.api$client.invoke(api.clj:24)
at simple.main$_main.invokeStatic(main.clj:16)
at simple.main$_main.invoke(main.clj:13)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at simple.main.main(Unknown Source)
at java.base@23/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
I am implementing the changes https://github.com/macielti/graalvm-clojure/blob/bump-aws-api-s3/aws-api-s3/project.clj. What is the correct way to load this missing resource?your ResourceConfigurationFiles// resource-config.json is not including the cognitect/aws/s3/service.edn file
checkout https://clojurians.slack.com/archives/CAJN79WNT/p1730395014839369
nice, I was able to fix this using this as the resource files configuration:
{
"resources": {
"includes": [
{
"pattern": "cognitect/aws/.+\\.edn"
}
]
}
}and after that it was asking by the Could not find cognitect_aws_http.edn on classpath
I will try to also include the cognitect_aws_http.edn with in the resource files configuration.
It worked!!! gratitude
{
"resources": {
"includes": [
{
"pattern": "cognitect/aws/.+\\.edn"
},
{
"pattern" : "cognitect_aws_http.edn"
}
]
}
}Try to use the GraalVM with tracing agent. With GraalVM tracing agent, you can run your JAR, the VM will track down all resources and reflections, and generate the configuration for you.
• write your app and create an uberjar
• Start your app.jar using https://www.graalvm.org/latest/reference-manual/native-image/guides/configure-with-tracing-agent/
• Use your app. At least, one read and one write on s3
• Stop your app
• Checkout the filter.json and the others files generated by the tracing agent
• Add all reflections reported by the tracing agent to your native-image using -H:ReflectionConfigurationFiles=reflect-config.json and -H:ResourceConfigurationFiles=resource-config.json
I tried to use it but I want to push to the minimal required configuration. the tracing agent returns a lot of stuff.
Btw, I used to do these steps inside the CI and use the generated reflect-config.json dynamically, without commit the huge file.
that is a good idea
here is a reference for you (also, a 🇧🇷 project 😉 ) https://github.com/moclojer/moclojer/blob/main/.github/workflows/build-native-image.yml#L28C19-L36
This will help me a lot. I am also building native image inside CI but the process I taking too long to complete. I need some optimization references.
If the project is open source, https://github.com/moclojer/moclojer/pull/21
https://github.com/clj-easy/graalvm-clojure/pull/67 reviewplease @borkdude what do you think?
@brunodonascimentomaci looks good I think. why did it work before without the resources configuration though? sidenote: if you want a quick starting aws api this also works with bb:
I am not sure if it could be related with bumping the dependencies to the latest version or using GraalVM 23 instead of the older versions.
Can I use it with Leiningen? I am not sure if it supports dependencies via git repository, in a way that it is compatible with the native image building process.
nope, lein does not support git deps
I mean, awyeah-api works with bb, so then you wouldn't need graalvm. That's what I wanted to say, I didn't mean to change to PR, just a side note
Nice. I asked because I intent to use this AWS s3 integration inside a project that uses Leiningen.