redis-om-spring icon indicating copy to clipboard operation
redis-om-spring copied to clipboard

Adding Redis om spring dependency in spring cloud stream project gives startup error

Open praks84 opened this issue 2 years ago • 3 comments

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.

praks84 avatar Sep 30 '22 09:09 praks84

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]


roux-jerome avatar Oct 04 '22 07:10 roux-jerome

Map<String, Object> annotatedBeans = ac.getBeansWithAnnotation(SpringBootApplication.class); // return an empty LinkedHashMap
Class<?> app = annotatedBeans.values().toArray()[0].getClass();

roux-jerome avatar Oct 04 '22 07:10 roux-jerome

RedisModulesConfiguration.ensureIndexesAreCreated is invoked twice. The first one ac.getBeansWithAnnotation(SpringBootApplication.class) is empty. The second one is not

roux-jerome avatar Oct 04 '22 07:10 roux-jerome

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

DavidFischer1010 avatar Oct 22 '22 19:10 DavidFischer1010

Oops, wrong account. This is the one... :D

daveish avatar Oct 22 '22 19:10 daveish

I am stuck because of this issue - any workaround suggestions to get going till the fix?

praks84 avatar Oct 28 '22 16:10 praks84

Next release will have solve this issue. Likely out by Monday.

bsbodden avatar Oct 28 '22 16:10 bsbodden

@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

bsbodden avatar Nov 03 '22 21:11 bsbodden