-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.
Description
Describe the bug
I am using Spring Shell to create a cli tool, the library works fine when run from the jar, however when compiled to a native binary and ran it throws a NullPointerException.
I have added the client-java-spring-aot-integrations
dependency but it doesn't seem to have resolved anything, and I am also required to add the following to reflect-config.json
otherwise I get a different error.
[
{
"name": "io.kubernetes.client.openapi.models.",
"unsafeAllocated": true
}
]
When running as native it errors after Kubectl.get(...)
is invoked:
2024-04-02T23:40:30.399+01:00 INFO 96712 --- [ main] com.rj93.cli.CliApplication : Started CliApplication in 0.071 seconds (process running for 0.097)
2024-04-02T23:40:30.400+01:00 INFO 96712 --- [ main] com.rj93.cli.commands.GetPodsCommand : Getting pods
2024-04-02T23:36:50.127+01:00 ERROR 96399 --- [ main] io.kubernetes.client.util.ModelMapper : Unexpected exception while loading classes
java.lang.NullPointerException: null
at io.kubernetes.client.util.ModelMapper.getClassNamesFromPackage(ModelMapper.java:479) ~[na:na]
at io.kubernetes.client.util.ModelMapper.initModelMap(ModelMapper.java:407) ~[na:na]
at io.kubernetes.client.util.ModelMapper.<clinit>(ModelMapper.java:81) ~[na:na]
at io.kubernetes.client.extended.kubectl.Kubectl$ApiClientBuilder.refreshDiscovery(Kubectl.java:236) ~[k8s-cli-native-example:na]
at io.kubernetes.client.extended.kubectl.KubectlGet.execute(KubectlGet.java:60) ~[k8s-cli-native-example:na]
at com.rj93.cli.commands.GetPodsCommand.getConfigMaps(GetPodsCommand.java:27) ~[k8s-cli-native-example:na]
Client Version
20.0.1
Kubernetes Version
1.29.1
Java Version
21.0.2-tem
GraalVM Version
21.0.2-graalce
To Reproduce
Reproducable example can be found here: https://github.com/rj93/k8s-cli-native-example
Expected behavior
A NullPointerExpcetion not to be thrown
KubeConfig
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: <<REDACTED>>
server: https://kubernetes.docker.internal:6443
name: docker-desktop
contexts:
- context:
cluster: docker-desktop
user: docker-desktop
name: docker-desktop
current-context: docker-desktop
kind: Config
preferences: {}
users:
- name: docker-desktop
user:
client-certificate-data: <<REDACTED>>
client-key-data: <<REDACTED>>
Server:
- OS: MacOS
- Environment: bash
- K8s Cluster: Docker Desktop
Metadata
Metadata
Assignees
Labels
lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.