Version: 16.0.0
I am creating a CronJob as below:
ApiClient client = Config.defaultClient();
Configuration.setDefaultApiClient(client);
InputStream cronJobYAML = Kub.class.getResourceAsStream("/cronJob.yaml");
String yaml = new BufferedReader(new InputStreamReader(cronJobYAML, StandardCharsets.UTF_8)).lines()
.collect(Collectors.joining("\n"));
//TODO: Add ModelMapper.addModelMap() here
V1CronJob yamlCronJob = (V1CronJob) Yaml.load(yaml); //<---------Exception Here
BatchV1Api batchAPI = new BatchV1Api();
V1CronJob createNamespacedCronJob = batchAPI.createNamespacedCronJob("default", yamlCronJob, "true", null, null, null);
but when I call YAML.load I get a null pointer exception followed by:
[err] java.io.IOException: Unknown apiVersionKind batch/v1/CronJob is it registered?
[err] at io.kubernetes.client.util.Yaml.modelMapper(Yaml.java:554)
[err] at io.kubernetes.client.util.Yaml.load(Yaml.java:93)
[err] at io.kubernetes.client.util.Yaml.load(Yaml.java:70)
The same code works for me when I create a maven project and run as jar.
I tried to debug more and I found that the issue is in https://github.com/kubernetes-client/java/blob/v16.0.0/util/src/main/java/io/kubernetes/client/util/ModelMapper.java#L461
packageURL = "wsjar:file:/C:/Users/Babak/.m2/repository/io/kubernetes/client-java-api/16.0.0/client-java-api-16.0.0.jar!/io/kubernetes/client/openapi/models"
So when uri.getPath() is called, it throws NullPointerException.
ClassLoader Type : com.ibm.ws.classloading.internal.AppClassLoader (I am using IBM websphere)
For now I am adding ModelMapper.addModelMap("batch", "v1", "CronJob", "CronJobs", V1CronJob.class, null); but I am not sure if something else would go wrong later.
Also, I am not sure if the value I put for the 4th param (CronJobs) is correct.
Version: 16.0.0
I am creating a CronJob as below:
but when I call YAML.load I get a null pointer exception followed by:
The same code works for me when I create a maven project and run as jar.
I tried to debug more and I found that the issue is in https://github.com/kubernetes-client/java/blob/v16.0.0/util/src/main/java/io/kubernetes/client/util/ModelMapper.java#L461
packageURL = "wsjar:file:/C:/Users/Babak/.m2/repository/io/kubernetes/client-java-api/16.0.0/client-java-api-16.0.0.jar!/io/kubernetes/client/openapi/models"So when
uri.getPath()is called, it throws NullPointerException.ClassLoader Type : com.ibm.ws.classloading.internal.AppClassLoader (I am using IBM websphere)For now I am adding
ModelMapper.addModelMap("batch", "v1", "CronJob", "CronJobs", V1CronJob.class, null);but I am not sure if something else would go wrong later.Also, I am not sure if the value I put for the 4th param (CronJobs) is correct.