I have updated the couchbase java-client to 3.3.4 previously I was using 2.7.x along with that I was using couchbase-spring-cache which is 2.1.0 version and no latest version for that is present in maven repo last version is 2.1.0
because the couchbase-spring-cache 2.1.0 uses couchbase java-client 2.3.6 linkhere
I am getting error while I run the maven application
below error explanation
com.couchbase.client.java.document.Document the package was changed in couchbase java-client 3.3.4 it is now being used as org.springframework.data.couchbase.core.mapping.Document;
the error is because the couchbase-spring-cache 2.1.0 is calling the Document from package com.couchbase.client.java.document.Document so java.lang.ClassNotFoundException
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in class path resource [restApi/RestApiConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/couchbase/client/java/document/Document
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) ~[spring-beans-5.3.31.jar:5.3.31]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:929) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.18.jar:2.7.18]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-2.7.18.jar:2.7.18]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:409) ~[spring-boot-2.7.18.jar:2.7.18]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.18.jar:2.7.18]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) ~[spring-boot-2.7.18.jar:2.7.18]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1289) ~[spring-boot-2.7.18.jar:2.7.18]
at restApi.Application.main(Application.java:35) ~[classes/:?]
Caused by: java.lang.NoClassDefFoundError: com/couchbase/client/java/document/Document
at com.couchbase.client.spring.cache.CacheBuilder.build(CacheBuilder.java:78) ~[couchbase-spring-cache-2.1.0.jar:?]
at com.couchbase.client.spring.cache.CouchbaseCacheManager.loadCaches(CouchbaseCacheManager.java:149) ~[couchbase-spring-cache-2.1.0.jar:?]
at org.springframework.cache.support.AbstractCacheManager.initializeCaches(AbstractCacheManager.java:62) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.cache.support.AbstractCacheManager.afterPropertiesSet(AbstractCacheManager.java:51) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.31.jar:5.3.31]
... 16 more
Caused by: java.lang.ClassNotFoundException: com.couchbase.client.java.document.Document
at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[?:?]
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
at com.couchbase.client.spring.cache.CacheBuilder.build(CacheBuilder.java:78) ~[couchbase-spring-cache-2.1.0.jar:?]
at com.couchbase.client.spring.cache.CouchbaseCacheManager.loadCaches(CouchbaseCacheManager.java:149) ~[couchbase-spring-cache-2.1.0.jar:?]
at org.springframework.cache.support.AbstractCacheManager.initializeCaches(AbstractCacheManager.java:62) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.cache.support.AbstractCacheManager.afterPropertiesSet(AbstractCacheManager.java:51) ~[spring-context-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.31.jar:5.3.31]
... 16 more
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.18</version>
</parent>
<dependency>
<groupId>com.couchbase.client</groupId>
<artifactId>couchbase-spring-cache</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>com.couchbase.client</groupId>
<artifactId>java-client</artifactId> <-- version it takes automatically is 3.3.4-->
</dependency>
is there any alternative way to cache the data of couchbase in couchbase bucket
NOTE: the data is stored in couchbase bucket xyz
** the cache data is stored in couchbase bucket xyz-cache**
Any Help is Appreciated Thanks