what is your general approach to making some java lib compile / run? issue in thread
runtime error when I call some static constructor thingy:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.google.api.client.googleapis.javanet.GoogleNetHttpTransport.newTrustedTransport(GoogleNetHttpTransport.java:87)
at com.google.api.client.googleapis.javanet.GoogleNetHttpTransport.newTrustedTransport(GoogleNetHttpTransport.java:58)
at google_api_clj.google_client$create_google_client.invokeStatic(google_client.clj:29)
...
Caused by: java.lang.IllegalStateException: No match found
at java.util.regex.Matcher.group(Matcher.java:645)
at com.google.api.client.googleapis.GoogleUtils.<clinit>(GoogleUtils.java:66)
... 9 more
https://cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.javanet.GoogleNetHttpTransport
I'm not sure but I think it is because it caches something when it initializesAre you using /constructing these objects from classes outside of functions?
I import the namespace package and call a static method in a function in a clojure namespace
How do your --initialize-at-build-time settings look?
"--initialize-at-build-time=com.google.api.client.util.DateTime"
"--initialize-at-build-time=com.google.common.base.Preconditions"
"--initialize-at-build-time=com.google.api.client.util.Data"
"--initialize-at-build-time=com.google.common.base.Preconditions"
"--initialize-at-build-time=com.google.api.services.sheets.v4.model.Spreadsheet"
"--initialize-at-build-time=com.google.api.services.sheets.v4.model.RowData"
"--initialize-at-build-time=com.google.api.services.sheets.v4.model.Sheet"
"--initialize-at-build-time=com.google.api.services.sheets.v4.model.DimensionProperties"
"--initialize-at-build-time=com.google.api.services.sheets.v4.model.FilterView"
"--initialize-at-build-time=com.google.api.services.sheets.v4.model.GridData"
"--initialize-at-build-time=com.google.api.services.sheets.v4.model.ProtectedRange"
"--initialize-at-build-time=com.google.api.services.sheets.v4.model.DimensionProperties"
"--initialize-at-build-time=com.google.api.services.sheets.v4.model.FilterView"
"--initialize-at-build-time=com.google.api.services.sheets.v4.model.ProtectedRange"
"--initialize-at-build-time=com.google.api.services.sheets.v4.model.GridData"
I just naively put all classes that graalvm threw as warningyou probably should avoid doing that
I see so it's initializing something that shouldn't be
yes, hence the "caching"
ah so I should figure out why it is initialized. And do the delay trick
yes. but it might be coming from your https://github.com/viebel/google-api-clj library you mentioned earlier.
oh yes I'll to go into there 😛
thamnks thanks bro
I got rid of all the build time initializing, unfortunately I still have this issue:
Caused by: java.lang.IllegalStateException: No match found
at java.util.regex.Matcher.group(Matcher.java:645)
at com.google.api.client.googleapis.GoogleUtils.<clinit>(GoogleUtils.java:66)
... 9 more
now I'm on another lead. I decompiled this GoogleUtils class with intellij and see there is some hardcoded regex pattern making assumption about the version string. This is promising because I just set the version to the git sha
it is using some .properties "resource". I saw there is a way to define resources for graalvm right?
ok I'm doing it https://www.graalvm.org/22.1/reference-manual/native-image/Resources/
right
isn't there some nice way to declare classes I use in my clojure code? Atm I'm adding classes 1 by 1 to my reflection.json config 😅
instead of doing that, you should probably get rid of reflection anyway
(set! **warn-on-reflection** true)
ok I try