Cannot instantiate DefaultKubernetesClient due to NoSuchMethodError
See original GitHub issueDescribe the bug
When create DefaultKubernetesClient(), there is a java exception
Fabric8 Kubernetes Client version
5.9.0
Steps to reproduce
- Create DefaultKubernetesClient
MyKubernetesInfo info;
Config config = new ConfigBuilder()
.withMasterUrl(info.getUrl())
.withOauthToken(info.getToken())
.withDisableHostnameVerification(true)
.withTrustCerts(true)
.build();
return new DefaultKubernetesClient(config);
- See the exception
Expected behavior
DefaultKubernetesClient() should be instantiated like version 5.4.1
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
other (please specify in additional context)
Environment
Linux
Fabric8 Kubernetes Client Logs
java.lang.NoSuchMethodError: 'java.lang.String io.fabric8.kubernetes.api.model.HasMetadata.getGroup(java.lang.Class)'
at io.fabric8.kubernetes.client.dsl.base.ResourceDefinitionContext.fromResourceType(ResourceDefinitionContext.java:51) ~[kubernetes-client-5.9.0.jar:na]
at io.fabric8.kubernetes.client.ResourceHandlerImpl.<init>(ResourceHandlerImpl.java:43) ~[kubernetes-client-5.9.0.jar:na]
at io.fabric8.kubernetes.client.Handlers.register(Handlers.java:50) ~[kubernetes-client-5.9.0.jar:na]
at io.fabric8.kubernetes.client.BaseKubernetesClient.<clinit>(BaseKubernetesClient.java:132) ~[kubernetes-client-5.9.0.jar:na]
at MyPackage.getNewKubernetesClient(Fabric8KubernetesApiClientPool.java:70) ~[main/:na]
Additional context
Kubernetes API version: 1.18
, 1.21
That code snippet worked at the lib version 5.4.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
NoSuchMethodError on OkHttpClient$Builder.pingInterval #45
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.
Read more >由于nosuchmethoderror,无法实例化defaultkubernetesclient
Cannot instantiate DefaultKubernetesClient due to NoSuchMethodError 描述错误当创建defaultkubernetesclient()时,有一个Java例外fabric8 ...
Read more >Setup Spring Cloud Data Flow server for Kubernetes
I couldn't find any certificate/fabric8 related configuration in documentation, ... IllegalArgumentException: Cannot instantiate interface ...
Read more >Red Hat Fuse 7.4 Release Notes
Red Hat is not formally related to or endorsed by the ... Openshift 4 + FMP: DefaultKubernetesClient cannot be cast to OpenShiftClient.
Read more >CHANGELOG.md · master · mirrors / fabric8io / kubernetes-client
The stream pumper related classes were also simplified to utility methods on ... cascading() causes NoSuchMethodError * Fix #1309: Can't get ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found something… I think there is a conflict with
Spring-Cloud
Without Spring cloud
In
build.gradle
:Result:
with spring-cloud configuration
In
build.gradle
:Result:
Compatibility table
Just for creating test of
DefaultKubernetesClient
Object.The result is depends on the version of
spring-cloud
andfabric8-kubernetes
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!