I did upgrade from 2.5.7(jdk-8) to 2.6.6(jdk-11)

I see the below class cast exception ::

java.lang.ClassCastException: class org.springframework.data.couchbase.repository.support.CrudMethodMetadataPostProcessor$DefaultCrudMethodMetadata cannot be cast to class org.springframework.data.jpa.repository.support.CrudMethodMetadata (org.springframework.data.couchbase.repository.support.CrudMethodMetadataPostProcessor$DefaultCrudMethodMetadata and org.springframework.data.jpa.repository.support.CrudMethodMetadata are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @8bd1b6a)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:153)

any suggestions?

Comment From: wilkinsona

Judging by the packages involve, you appear to be mixing Spring Data JPA and Spring Data Couchbase somehow. I would double-check the Spring Data-related configuration in your application, in particular to see if there is some overlap between the repositories and entities that are being used with JPA and Couchbase. If this does not help and you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

Comment From: venkatjavaji

@wilkinsona thanks for the reply. We are using separate configuration for spring-jpa-data and spring-couchbase-data. Our application has many jpa entities but surprisingly this issue is triggering only on one jpa-entity during findById(Long id) call.

This is intermittently occurring but once it is triggered it keeps on throwing the error and it goes away with restart but pop-ups again.

allow me sometime to share you the replica of our jpa and cb configuration with a sample project.

Comment From: venkatjavaji

This issues seems to be caused because of missing below

EnableJpaRepositories for jpa repository and EnableCouchbaseRepositories for cb repository

Post this declaration application is working without ClassCastException

Comment From: wilkinsona

Thanks for letting us know, @venkatjavaji.

Comment From: venkatjavaji

Had this issue again and it's intermittently occurring..

[DEBUG  ] 2022-05-23 13:20:33.706 [http-nio-8081-exec-6] JpaTransactionManager - Not closing pre-bound JPA EntityManager after transaction
[DEBUG  ] 2022-05-23 13:20:33.706 [http-nio-8081-exec-6] JpaTransactionManager - Found thread-bound EntityManager [SessionImpl(1953954062<open>)] for JPA transaction
[DEBUG  ] 2022-05-23 13:20:33.706 [http-nio-8081-exec-6] JpaTransactionManager - Creating new transaction with name [com.digital.risk.app.data.service.AlertOperationsServiceImpl.findById]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
[DEBUG  ] 2022-05-23 13:20:33.706 [http-nio-8081-exec-6] JpaTransactionManager - Exposing JPA transaction as JDBC [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@3ac4168c]
java.lang.ClassCastException: class org.springframework.data.couchbase.repository.support.CrudMethodMetadataPostProcessor$DefaultCrudMethodMetadata cannot be cast to class org.springframework.data.jpa.repository.support.CrudMethodMetadata (org.springframework.data.couchbase.repository.support.CrudMethodMetadataPostProcessor$DefaultCrudMethodMetadata and org.springframework.data.jpa.repository.support.CrudMethodMetadata are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @8bd1b6a)
        at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:153)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
        at com.sun.proxy.$Proxy301.findById(Unknown Source)

Unable to recreate with exact replica and share it to you.. any other things to share to troubleshoot this issue?

Comment From: wilkinsona

Not that I can think of. Any suggestions, @mp911de?

Comment From: mp911de

This is a bug in Spring Data Couchbase where transactional resources are bound during an AOP-intercepted call but not unbound after the call. The issue was fixed with https://github.com/spring-projects/spring-data-couchbase/issues/1392, the fix will be released with the Spring Data 2021.1.5 release next month.

Comment From: wilkinsona

Thanks very much, @mp911de.

Comment From: vivekanandyaram

Thanks for the confirmation @mp911de . I see that Spring-data-couchbase 4.4.0 is already out, can you confirm if the fix is part of 4.4.0. This is actually blocking us in promoting the spring upgrade to Prod environment.

Comment From: venkatjavaji

Thanks for the update @mp911de

Right now spring-data-couchbase version is 4.3.3 earlier when springboot was 2.5.7 the cb version was 4.2.7(we don't see this issue here)

Could you suggest which version of spring-data-couchbase to be degraded/upgraded to work with spring-boot:2.6.6

Or should we wait for the fix until next month!? Please confirm. Thank you.

Comment From: mp911de

Paging @mikereiche

Comment From: mikereiche

The fix is indeed in 4.4.0 https://github.com/spring-projects/spring-data-couchbase/commit/f6944a78fba42bf546bc9c4beaf1ac0558709df6

Comment From: vivekanandyaram

@mikereiche , Can you confirm the exact version which has fix after 4.3.3.

We tried upgrading to 4.4.0 and seems we are seeing an issue with some of our application tests. Would be great if you can confirm the exact version of the fix as we can use that version instead of going to 4.4.0.

Comment From: mikereiche

It's also in 4.3.x since April 15. So 4.3.4 . [ Correction - May 11, so not in 4.3.4 ]

We tried upgrading to 4.4.0 and seems we are seeing an issue with some of our application tests.

couchbase issues? Can you please open couchbase tickets for that? Thanks.

Comment From: vivekanandyaram

It's also in 4.3.x since April 15. So 4.3.4 .

We tried upgrading to 4.4.0 and seems we are seeing an issue with some of our application tests.

couchbase issues? Can you please open couchbase tickets for that? Thanks.

Thanks @mikereiche. Not sure about the test failure at this moment as we haven't spent much time in analysing. Will keep you posted.

Comment From: jorgerod

It's also in 4.3.x since April 15. So 4.3.4 .

We tried upgrading to 4.4.0 and seems we are seeing an issue with some of our application tests.

couchbase issues? Can you please open couchbase tickets for that? Thanks.

Hi @mikereiche

I have the same problem. I have an application that still can't upgrade to 4.4.0 and with 4.3.4 it is not worked for me. I have checked that the fix to this bug is not in 4.3.4 but it is in 4.3.x.

Is there a planned release date for 4.3.5?

Thank you very much

Comment From: mp911de

@jorgerod the current plan is to ship service releases on June, 20th. You can find all Spring release dates in the release calendar at calendar.spring.io.

Comment From: venkatjavaji

The fix is indeed in 4.4.0 spring-projects/spring-data-couchbase@f6944a7

Upgrading the sping-data-couchbase:4.4.0 fixed our issue . Thank you.

Comment From: mikereiche

It's also in 4.3.x since April 15. So 4.3.4 . [ Correction - May 11, so not in 4.3.4 ] I don't know why it shows "Last commit eec0a0a6 on Apri 15", but "Commits on May 11".

Screen Shot 2022-05-31 at 3 33 04 PM Screen Shot 2022-05-31 at 3 32 05 PM