Actuator health check stopped working after upgrading couchbase SDK from 2.7.x to 3.4.2 version

Hello,

I am working on upgrading the couchbase java client sdk version from 2.7.x to 3.4.2 in spring boot application (spring boot version is 2.1.4.RELEASE). After resolving all compile time errors, i am still seeing below issues with actuator health check.

2023-02-17 18:00:36.522 ERROR 17022 — [o-8080-exec-119] o.s.b.w.s.s.ErrorPageFilter : Forwarding to error page from request [/actuator/health] due to exception [Found class com.couchbase.client.
java.Cluster, but interface was expected]
java.lang.IncompatibleClassChangeError: Found class com.couchbase.client.java.Cluster, but interface was expected
at org.springframework.boot.actuate.couchbase.CouchbaseHealthIndicator.doHealthCheck(CouchbaseHealthIndicator.java:51) ~[spring-boot-actuator-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:84) ~[spring-boot-actuator-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:98) ~[spring-boot-actuator-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.actuate.health.HealthEndpoint.health(HealthEndpoint.java:50) ~[spring-boot-actuator-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.actuate.health.HealthEndpointWebExtension.health(HealthEndpointWebExtension.java:54) ~[spring-boot-actuator-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_275]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_275]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_275]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_275]
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) ~[spring-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:76) ~[spring-boot-actuator-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:61) ~[spring-boot-actuator-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$ServletWebOperationAdapter.handle(AbstractWebMvcEndpointHandlerMapping.java:294) ~[spring-boot-actuator-2.1
.4.RELEASE.jar:2.1.4.RELEASE]

Below is my pom.xml configuration -

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.1.4.RELEASE</version>
	<relativePath /> <!-- lookup parent from repository -->
</parent>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<couchbase-client.version>3.4.2</couchbase-client.version>
	<cloud-config.version>2.1.5.RELEASE</cloud-config.version>
    <java.version>1.8</java.version>
    <maven.compiler.source>8</maven.compiler.source>
	<maven.compiler.target>8</maven.compiler.target>   
	<skip.install>true</skip.install>
	<log4j2.version>2.17.1</log4j2.version>
</properties>

<dependencies>
		
	<dependency>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-starter-config</artifactId>
		<version>${cloud-config.version}</version>
	</dependency>
	
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter</artifactId>
		<exclusions>
			<exclusion>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-starter-logging</artifactId>
			</exclusion>
		</exclusions>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-log4j2</artifactId>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-actuator</artifactId>
	</dependency>

Can someone please help me to resolve this error ?

Hi @SuhasT ,

In Couchbase SDK 2, Cluster was an interface; in SDK 3, it’s a concrete class. This exception makes me suspect spring-boot-actuator-2.1.4 was compiled against Couchbase SDK 2, because it’s expecting an SDK 2 Cluster interface, but finding an SDK 3 Cluster class.

Spring Boot 2.1 is pretty old. I would try upgrading to a later version.

Thanks,
David

Thanks @david.nault for your suggestions.

I will try this by upgrading the spring boot version.

Thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.