Skip to content

Context load test fails with Spring Boot 2.6.1 and Spring Cloud 2021.0.0 #934

@Alos

Description

@Alos

Describe the bug
While running the contextLoads test Spring Cloud Kubernetes fails with the following:

Error creating bean with name 'kubernetesKubectlCreateProcessor': Unsatisfied dependency expressed through field 
'apiClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with
 name 'defaultApiClient' defined in class path resource 
[io/kubernetes/client/spring/extended/controller/config/KubernetesInformerAutoConfiguration.class]: Bean 
instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: 
Failed to instantiate [io.kubernetes.client.openapi.ApiClient]: Factory method 'defaultApiClient' threw exception;
 nested exception is java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "expiryObj" is null
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659)
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
'defaultApiClient' defined in class path resource [io/kubernetes/client/spring/extended/controller/config/KubernetesInformerAutoConfiguration.class]:
 Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
 Failed to instantiate [io.kubernetes.client.openapi.ApiClient]: Factory method 'defaultApiClient' threw exception; 
nested exception is java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "expiryObj" is null
...
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.kubernetes.client.openapi.ApiClient]: 
Factory method 'defaultApiClient' threw exception; nested exception is java.lang.NullPointerException: 
Cannot invoke "Object.getClass()" because "expiryObj" is null
...
Caused by: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "expiryObj" is null
	at io.kubernetes.client.util.authenticators.GCPAuthenticator.isExpired(GCPAuthenticator.java:54)
	at io.kubernetes.client.util.KubeConfig.getAccessToken(KubeConfig.java:214)

Is there a way to tell Spring Cloud Kubernetes to not try to access the API and authenticate while running JUnit tests?

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesPull requests that update a dependency file

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions