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

NoClassDefFoundError io/fabric8/kubernetes/client/dsl/ServerSideApplicable #6570

Open
prakashreddy-97 opened this issue Nov 12, 2024 · 6 comments
Labels
question Waiting on feedback Issues that require feedback from User/Other community members

Comments

@prakashreddy-97
Copy link

Describe the bug

Hello Team,

I am trying to use the @EnableKubernetesMockClient annotation to create a kubernetesClient in my test class which are in juupiter junit, but I am getting the following error.

NoClassDefFoundError io/fabric8/kubernetes/client/dsl/ServerSideApplicable

Fabric8 Kubernetes Client version

6.3.1

Steps to reproduce

import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
import org.junit.jupiter.api.Test;

@EnableKubernetesMockClient
class MyTest {

KubernetesClient client;

##Code
}

Expected behavior

Would like to get a mocked value for kubernetsClient

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.25.3@latest

Environment

Windows

Fabric8 Kubernetes Client Logs

No response

Additional context

No response

@manusa
Copy link
Member

manusa commented Nov 13, 2024

You seem to be using an older version of the client (6.3.1).
I also suspect that your project might also be using a third-party library or framework such as Spring, Quarkus, etc. that might also bring a newer (or older version of the client).
Could you please confirm this?

@manusa manusa added the Waiting on feedback Issues that require feedback from User/Other community members label Nov 13, 2024
@prakashreddy-97
Copy link
Author

prakashreddy-97 commented Nov 15, 2024

Hey @manusa, Yes we are using the springboot framework(3.0.19), java version 17. We were using groovy for unit tests before upgrading to these versions and couldn't mock the kubernetes-client. Thats when we started using the jupiter-junit and still could not mock the kubernetes-client.

@manusa
Copy link
Member

manusa commented Nov 15, 2024

Are you using Spring Cloud Kubernetes too?
Check if the Fabric8 Kubernetes Client is being imported transitively from one of those libraries. It's likely that you have a version convergence issue.

@prakashreddy-97
Copy link
Author

We are not using Spring Cloud Kubernetes, and there are no other dependencies that import kubernetes-client

@manusa
Copy link
Member

manusa commented Nov 15, 2024

Try to create a reproducer project then.
The code you showed should be working with a standard Kubernetes Client project setup.

@prakashreddy-97
Copy link
Author

Ok, will try that and get back to you. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Waiting on feedback Issues that require feedback from User/Other community members
Projects
None yet
Development

No branches or pull requests

2 participants