redis-om-spring
redis-om-spring copied to clipboard
Adding Redis om spring dependency in spring cloud stream project gives startup error
Hello,
I have a spring cloud stream project with kafka streams binder dependency - no issues at startup. Next I add redis om spring dependency 0.6.0, add a model object annotate it with @Document and annotate main class with @EnableRedisDocumentRepositories. Now I get below error at startup
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 at com.redis.om.spring.RedisModulesConfiguration.getBeanDefinitionsFor(RedisModulesConfiguration.java:392)
Apologies for any mistake in posting this issue with details - new to this, so please guide me.
Hello, I have same issue. versions : Spring-boot : 2.6.12 spring-cloud : 2021.0.4 redis-om-spring : 0.6.0
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at com.redis.om.spring.RedisModulesConfiguration.getBeanDefinitionsFor(RedisModulesConfiguration.java:392) ~[redis-om-spring-0.6.0.jar:na]
at com.redis.om.spring.RedisModulesConfiguration.createIndicesFor(RedisModulesConfiguration.java:196) ~[redis-om-spring-0.6.0.jar:na]
at com.redis.om.spring.RedisModulesConfiguration.ensureIndexesAreCreated(RedisModulesConfiguration.java:157) ~[redis-om-spring-0.6.0.jar:na]
Map<String, Object> annotatedBeans = ac.getBeansWithAnnotation(SpringBootApplication.class); // return an empty LinkedHashMap
Class<?> app = annotatedBeans.values().toArray()[0].getClass();
RedisModulesConfiguration.ensureIndexesAreCreated
is invoked twice. The first one ac.getBeansWithAnnotation(SpringBootApplication.class)
is empty. The second one is not
See my Comment in the commit, this might be the cause. My previous fix has somehow regressed, I don't know the consequences of reverting this, since a lot has changed, so you might look into this @bsbodden.
The error occurs when I try to send an event via Spring Cloud Stream.
Best, David
Oops, wrong account. This is the one... :D
I am stuck because of this issue - any workaround suggestions to get going till the fix?
Next release will have solve this issue. Likely out by Monday.
@praks84 @roux-jerome This should be fix in https://s01.oss.sonatype.org/content/repositories/snapshots/com/redis/om/redis-om-spring/0.6.2-SNAPSHOT/ a proper 0.6.2 release is pending