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

Getting java.lang.NoSuchMethodError after upgraing to 21.0.0 #3539

Open
munishchouhan opened this issue Jul 5, 2024 · 1 comment
Open

Getting java.lang.NoSuchMethodError after upgraing to 21.0.0 #3539

munishchouhan opened this issue Jul 5, 2024 · 1 comment

Comments

@munishchouhan
Copy link

Describe the bug
getting java.lang.NoSuchMethodError: 'void io.kubernetes.client.openapi.models.V1Pod.validateJsonObject(com.google.gson.JsonObject)' at

k8sClient.coreV1Api()
                .createNamespacedPod(namespace, spec)
                .execute()

after upgrading to 21.0.0

Client Version
21.0.0

Kubernetes Version
v1.28.3+k3s2

Java Version
Java 11

To Reproduce
Steps to reproduce the behavior:

Expected behavior
should not throw error

KubeConfig
I am using colima

Server (please complete the following information):

  • Locally on MAC OS 14.5

Additional context

java.lang.NoSuchMethodError: 'void io.kubernetes.client.openapi.models.V1Pod.validateJsonObject(com.google.gson.JsonObject)'
	at io.kubernetes.client.openapi.models.V1Pod$CustomTypeAdapterFactory$1.read(V1Pod.java:309)
	at io.kubernetes.client.openapi.models.V1Pod$CustomTypeAdapterFactory$1.read(V1Pod.java:299)
	at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:308)
	at com.google.gson.Gson.fromJson(Gson.java:1361)
	at com.google.gson.Gson.fromJson(Gson.java:1262)
	at com.google.gson.Gson.fromJson(Gson.java:1171)
	at com.google.gson.Gson.fromJson(Gson.java:1137)
	at io.kubernetes.client.openapi.JSON.deserialize(JSON.java:778)
	at io.kubernetes.client.openapi.ApiClient.deserialize(ApiClient.java:895)
	at io.kubernetes.client.openapi.ApiClient.handleResponse(ApiClient.java:1105)
	at io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:1029)
	at io.kubernetes.client.openapi.apis.CoreV1Api.createNamespacedPodWithHttpInfo(CoreV1Api.java:10876)
	at io.kubernetes.client.openapi.apis.CoreV1Api$APIcreateNamespacedPodRequest.execute(CoreV1Api.java:10972)

@brendandburns
Copy link
Contributor

21.0.0 changed the underlying code generator and is incompatible with older versions, I suspect that you somehow have older versions of some parts of the client in your classpath somewhere.

You can use 21.0.0-legacy to maintain the old code generator, but you probably need to clean up your dependencies rather than stick to the legacy releases which will eventually be deprecated.

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