question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NoClassDefFoundError: io/fabric8/kubernetes/internal/KubernetesDeserializer

See original GitHub issue

With 5.8.0 running on OSGI we get a NoClassDefFoundError.

The io.fabric8.kubernetes.client.dsl.internal.HasMetadataOperationsImpl from the kubernetes-client module is referencing the io.fabric8.kubernetes.internal.KubernetesDeserializer class from the kubernetes-model-core module which declares the package io.fabric8.kubernetes.internal as private and doesn’t export it.


java.lang.NoClassDefFoundError: io/fabric8/kubernetes/internal/KubernetesDeserializer                                                                                                                                   
     at io.fabric8.kubernetes.client.dsl.internal.HasMetadataOperationsImpl.<init>(HasMetadataOperationsImpl.java:62)                                                                                                    
     at io.fabric8.kubernetes.client.dsl.internal.HasMetadataOperationsImpl.<init>(HasMetadataOperationsImpl.java:39)                                                                                                    
     at io.fabric8.kubernetes.client.ResourceHandlerImpl.operation(ResourceHandlerImpl.java:70)                                                                                                                          
     at io.fabric8.kubernetes.client.Handlers.getOperation(Handlers.java:65)                                                                                                                                             
     at io.fabric8.kubernetes.client.Handlers.getNonListingOperation(Handlers.java:69)                                                                                                                                   
     at io.fabric8.kubernetes.client.V1AuthorizationAPIGroupClient.selfSubjectAccessReview(V1AuthorizationAPIGroupClient.java:40)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:27 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
hanneshofmanncommented, Jan 7, 2022

Sorry - I am currently OOO and I don’t have access to any machine to test it. As far as I recall, we used the bundle jar back then when the issue has occured. I will try to verify this once again at the beginning of next week.

1reaction
rohanKanojiacommented, Jan 13, 2022

Hello guys, I have tried preparing a reproducer project https://github.com/rohankanojia-forks/kubernetes-client-osgi-demo . Basically, I’m just creating a Book custom resource. I’m sure control that goes through HasMetadataOperationsImpl and custom resource class is registered via KubernetesDeserializer

  public void createBook() {
    try (KubernetesClient client = new DefaultKubernetesClient()) {
      MixedOperation<Book, BookList, Resource<Book>> fooClient = client.customResources(Book.class, BookList.class);
      Book foo = fooClient.load(getClass().getResourceAsStream("/test-foo.yml")).get();
      foo.getMetadata().setName("book" + count);
      fooClient.inNamespace("default").createOrReplace(foo);
    }
  }

I deployed this application to Kubernetes using Kubernetes Maven Plugin where it’s run in a Karaf based image:

$ eval $(minikube -p minikube docker-env)
$ mvn k8s:build k8s:resource k8s:apply
...
$ kubectl get pods
NAME                                          READY   STATUS    RESTARTS   AGE
kubernetes-client-osgi-demo-db47c6f76-p77zm   1/1     Running   0          14s

As expected I was able to see Book resources being created every second:

kubernetes-client-osgi-demo : $ kubectl get book -w
NAME     AGE
book1    49s
book10   4s
book2    44s
book3    39s
book4    34s
book5    29s
book6    24s
book7    19s
book8    14s
book9    9s
book11   0s
book12   0s

Could you please check if I have prepared the reproducer correctly 🙏 ? It could be possible that I have missed something since I’m not familiar with OSGi.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I solve "java.lang.NoClassDefFoundError"?
The NoClassDefFoundError indicates that the classloader (in this case java.net.URLClassLoader ), which is responsible for dynamically loading classes, cannot ...
Read more >
3 ways to solve java.lang.NoClassDefFoundError in Java J2EE
A simple example of NoClassDefFoundError is class belongs to a missing JAR file or JAR was not added into classpath or sometimes jar's...
Read more >
java.lang.NoClassDefFoundError - DigitalOcean
NoClassDefFoundError is runtime error thrown when a required class is not found in the classpath and hence JVM is unable to load it...
Read more >
Why am I encountering java.lang.NoClassDefFoundError at ...
In workbench, adding projects directly to the java build path will allow code to compile, but it will not be able to resolve...
Read more >
Error "java.lang.NoClassDefFoundError - My Oracle Support
Oracle Data Integrator - Version 12.2.1.0.0 to 12.2.1.2.0 [Release 12c]: Error "java.lang.NoClassDefFoundError: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found