You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Spring Data Cassandra 4.1.2, Spring Boot 3.1.2, and spring-tx-6.0.11 if I instantiate the ObservableCqlSessionFactoryBean startup fails with an IllegalStateException.
When disabling exception translation from spring-tx this issue goes away. It seems this is tied to a change to support ObservableReactiveSessionFactoryBean's unwrapping of an already wrapped CqlSession.
Stack trace is as follows:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'observableCqlSessionFactoryBean': Post-processing of FactoryBean's singleton object failed
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:108)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1823)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1273)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:259)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1640)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1597)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:888)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
... 87 more
Caused by: org.springframework.aop.AopInvocationException: AOP configuration seems to be invalid: tried calling method [public abstract java.lang.Class org.springframework.aop.TargetSource.getTargetClass()] on target [com.datastax.oss.driver.internal.core.session.DefaultSession@30adae45]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:351)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.data.cassandra.observability.CqlSessionObservationInterceptor.invoke(CqlSessionObservationInterceptor.java:120)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:244)
at jdk.proxy2/jdk.proxy2.$Proxy127.getTargetClass(Unknown Source)
at org.springframework.aop.support.AopUtils.getTargetClass(AopUtils.java:111)
at org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor.postProcessAfterInitialization(AbstractAdvisingBeanPostProcessor.java:95)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:434)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1890)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:105)
... 98 more
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
... 109 more
The text was updated successfully, but these errors were encountered:
Good catch, that's fixed now in Spring Data Cassandra. We missed to handle the getTargetClass method properly.
mp911de
changed the title
ObservableCqlSessionFactoryBean causes an IllegalStateException when spring-data-tx's DAO exception translation is enabled
Observation proxies do not handle getTargetClass method invocation
Aug 23, 2023
Using Spring Data Cassandra 4.1.2, Spring Boot 3.1.2, and spring-tx-6.0.11 if I instantiate the ObservableCqlSessionFactoryBean startup fails with an IllegalStateException.
When disabling exception translation from spring-tx this issue goes away. It seems this is tied to a change to support ObservableReactiveSessionFactoryBean's unwrapping of an already wrapped CqlSession.
Stack trace is as follows:
The text was updated successfully, but these errors were encountered: