JedisConnectionFactory send error: java.lang.VerifyError: Bad return type

535 views
Skip to first unread message

angel paloalto

unread,
Mar 11, 2021, 5:23:52 AM3/11/21
to Jedis
Hi!

I have  an application with spring boot starter data redis 2.2.10 and jedis 3.3.0 when starting it throws me the following:

AnnotationConfigServletWebServerApplicationContext:559 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionRepositoryFilterRegistration' defined in class path resource [org/springframework/boot/autoconfigure/session/SessionRepositoryFilterConfiguration.class]: Unsatisfied dependency expressed through method 'sessionRepositoryFilterRegistration' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConfig' defined in VFS resource ["/com/example/redis/RedisConfig.class"]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConnectionFactory' defined in class path resource [com/example/redis/RedisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisConnectionFactory]: Circular reference involving containing bean 'redisConfig' - consider declaring the factory method as static for independence from its containing instance. Factory method 'redisConnectionFactory' threw exception; nested exception is java.lang.VerifyError: Bad return type
Exception Details:
  Location:
    org/springframework/data/redis/connection/jedis/JedisConnectionFactory.createRedisPool()Lredis/clients/jedis/util/Pool; @95: areturn
  Reason:
    Type 'redis/clients/jedis/JedisPool' (current frame, stack[0]) is not assignable to 'redis/clients/jedis/util/Pool' (from method signature)
  Current Frame:
    bci: @95
    flags: { }
    locals: { 'org/springframework/data/redis/connection/jedis/JedisConnectionFactory' }
    stack: { 'redis/clients/jedis/JedisPool' }
  Bytecode:
    0x0000000: bb00 6659 2ab6 0058 2ab6 002a 2ab6 002b
    0x0000010: 2ab7 002c 2ab7 002d 2ab7 0062 2ab6 0063
    0x0000020: 2ab6 003e 2ab6 0064 2ab6 002e 2ab4 000e
    0x0000030: b900 2f01 0001 b600 30c0 0031 2ab4 000e
    0x0000040: b900 3201 0001 b600 30c0 0033 2ab4 000e
    0x0000050: b900 3401 0001 b600 30c0 0035 b700 67b0
    0x0000060:


My methods are:

public JedisPoolConfig poolConfig() {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        jedisPoolConfig.setMaxTotal(50);
        jedisPoolConfig.setMaxWaitMillis(5000);
        jedisPoolConfig.setMaxIdle(50);
        jedisPoolConfig.setMinIdle(0);
        jedisPoolConfig.setTestWhileIdle(true);
        return jedisPoolConfig;
    }
    
    public RedisStandaloneConfiguration redisStandaloneConfiguration() {
        return new RedisStandaloneConfiguration("localhost", 6379);
    }
    
    public JedisClientConfiguration clientConfiguration() {
        JedisClientConfigurationBuilder jedisClientConfiguration = JedisClientConfiguration.builder();
        return jedisClientConfiguration.usePooling().poolConfig(poolConfig()).build();
    }

@Bean
    public JedisConnectionFactory redisConnectionFactory() {
        return new JedisConnectionFactory(redisStandaloneConfiguration(), clientConfiguration());
    }


I hope someone can help me, thanks!

Sazzadul Hoque

unread,
Mar 11, 2021, 5:47:45 AM3/11/21
to jedis...@googlegroups.com
Did you dig into:

1. "Circular reference involving containing bean 'redisConfig' - consider declaring the factory method as static for independence from its containing instance."

2. "Factory method 'redisConnectionFactory' threw exception;"

??

--
You received this message because you are subscribed to the Google Groups "Jedis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jedis_redis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jedis_redis/dffec803-d274-4a2c-aac5-4a66867a37ben%40googlegroups.com.

angel paloalto

unread,
Mar 11, 2021, 12:44:20 PM3/11/21
to Jedis
yes:
1. Error is:
AnnotationConfigServletWebServerApplicationContext:559 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionRepositoryFilterRegistration' defined in class path resource [org/springframework/boot/autoconfigure/session/SessionRepositoryFilterConfiguration.class]: Unsatisfied dependency expressed through method 'sessionRepositoryFilterRegistration' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConfig' defined in VFS resource ["/com/example/redis/RedisConfig.class"]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConnectionFactory' defined in class path resource [com/example/redis/RedisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisConnectionFactory]: Factory method 'redisConnectionFactory' threw exception; nested exception is java.lang.VerifyError: Bad return type
Exception Details:
  Location:
    org/springframework/data/redis/connection/jedis/JedisConnectionFactory.createRedisSentinelPool(Lorg/springframework/data/redis/connection/RedisSentinelConfiguration;)Lredis/clients/jedis/util/Pool; @67: areturn
  Reason:
    Type 'redis/clients/jedis/JedisSentinelPool' (current frame, stack[0]) is not assignable to 'redis/clients/jedis/util/Pool' (from method signature)
  Current Frame:
    bci: @67
    flags: { }
    locals: { 'org/springframework/data/redis/connection/jedis/JedisConnectionFactory', 'org/springframework/data/redis/connection/RedisSentinelConfiguration', 'org/apache/commons/pool2/impl/GenericObjectPoolConfig' }
    stack: { 'redis/clients/jedis/JedisSentinelPool' }
  Bytecode:
    0x0000000: 2ab6 0055 c600 0a2a b600 55a7 000a bb00
    0x0000010: 1559 b700 164d bb00 5659 2bb6 0057 b900
    0x0000020: 5801 002a 2bb6 0059 b700 5a2c 2ab7 002c
    0x0000030: 2ab7 002d 2ab6 005b 2ab6 003e 2ab6 005c
    0x0000040: b700 5db0
  Stackmap Table:
    same_frame(@14)
    same_locals_1_stack_item_frame(@21,Object[#267])

2. When I try:
@Bean
    public static JedisConnectionFactory redisConnectionFactory() {
        try {
            log.info("Inside block try");
            return new JedisConnectionFactory(redisStandaloneConfiguration(), clientConfiguration());   
        }catch(Exception e) {
            log.info("Return null because failed");
            return null;
        }
    }

Error is:
RedisConfig:70 - Inside block try |#]
AnnotationConfigServletWebServerApplicationContext:559 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionRepositoryFilterRegistration' defined in class path resource [org/springframework/boot/autoconfigure/session/SessionRepositoryFilterConfiguration.class]: Unsatisfied dependency expressed through method 'sessionRepositoryFilterRegistration' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConfig' defined in VFS resource ["/com/example/redis/RedisConfig.class"]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConnectionFactory' defined in class path resource [com/example/redis/RedisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisConnectionFactory]: Factory method 'redisConnectionFactory' threw exception; nested exception is java.lang.VerifyError: Bad return type
Exception Details:
  Location:
    org/springframework/data/redis/connection/jedis/JedisConnectionFactory.createRedisSentinelPool(Lorg/springframework/data/redis/connection/RedisSentinelConfiguration;)Lredis/clients/jedis/util/Pool; @67: areturn
  Reason:
    Type 'redis/clients/jedis/JedisSentinelPool' (current frame, stack[0]) is not assignable to 'redis/clients/jedis/util/Pool' (from method signature)
  Current Frame:
    bci: @67
    flags: { }
    locals: { 'org/springframework/data/redis/connection/jedis/JedisConnectionFactory', 'org/springframework/data/redis/connection/RedisSentinelConfiguration', 'org/apache/commons/pool2/impl/GenericObjectPoolConfig' }
    stack: { 'redis/clients/jedis/JedisSentinelPool' }
  Bytecode:
    0x0000000: 2ab6 0055 c600 0a2a b600 55a7 000a bb00
    0x0000010: 1559 b700 164d bb00 5659 2bb6 0057 b900
    0x0000020: 5801 002a 2bb6 0059 b700 5a2c 2ab7 002c
    0x0000030: 2ab7 002d 2ab6 005b 2ab6 003e 2ab6 005c
    0x0000040: b700 5db0
  Stackmap Table:
    same_frame(@14)
    same_locals_1_stack_item_frame(@21,Object[#267])

angel paloalto

unread,
Mar 19, 2021, 4:01:21 PM3/19/21
to Jedis
I had to change version spring data redis to 2.1.21 and that´s it
Reply all
Reply to author
Forward
0 new messages