0

We are unable to start our Spring Boot application (version 2.1.9.RELEASE) when using Hazelcast (artifact hazelcast-all and version 4.1). I get error

An attempt was made to call a method that does not exist. The attempt was made from the following location:   org.springframework.boot.actuate.metrics.cache.HazelcastCacheMeterBinderProvider.getMeterBinder(HazelcastCacheMeterBinderProvider.java)

The following method did not exist: com.hazelcast.spring.cache.HazelcastCache.getNativeCache()Lcom/hazelcast/core/IMap;

The method's class, com.hazelcast.spring.cache.HazelcastCache, is available from the following locations: jar:file:<path>/.m2/repository/com/hazelcast/hazelcast-all/4.1/hazelcast-all-4.1.jar!/com/hazelcast/spring/cache/HazelcastCache.class

It was loaded from the following location: file:<path>/.m2/repository/com/hazelcast/hazelcast-all/4.1/hazelcast-all-4.1.jar

Action: Correct the classpath of your application so that it contains a single, compatible version of com.hazelcast.spring.cache.HazelcastCache We checked for IMap class - package com.hazelcast.map.IMap. Any solution/suggestion on this issue?

Vy Do
  • 46,709
  • 59
  • 215
  • 313
  • Can you print what is the output when you run mvn dependency:tree | grep hazelcast . This will help narrow down any CP conflicts that we may be seeing with different libs loading different versions of the class . – Ramachandran.A.G Jan 27 '22 at 14:30
  • we got below result after executing "mvn dependency:tree | grep hazelcast" Result: com.hazelcast:hazelcast-all:jar:4.1:compile – Shraddha Kadam Jan 28 '22 at 06:16

1 Answers1

0

Trying to see if the following compatibility works. Just looking at https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-actuator-autoconfigure/2.1.9.RELEASE , the HazelCast version is 3.11.4. Can you change the version of hazelcast from 4.1 to 3.11.4 (on the POM) and try it again.

<dependency>
    <groupId>com.hazelcast</groupId>
    <artifactId>hazelcast-all</artifactId>
    <version>3.11.4</version>
</dependency>
Ramachandran.A.G
  • 4,788
  • 1
  • 12
  • 24
  • We use 3.11.4, but when we deploy in kubernates then getting below error : org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tracingFilter' defined in class path resource [org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.class]: Unsatisfied dependency expressed through method 'tracingFilter' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: – Shraddha Kadam Jan 31 '22 at 07:03
  • This is probably not related to this question . This is probably another missing dependency – Ramachandran.A.G Jan 31 '22 at 07:05