Problem loading application without the need of REDIS
alkaphreak opened this issue · comments
When the persistence and the scheduler are disabled :
spring.mail.scheduler.enabled=false
spring.mail.scheduler.priorityLevels=10
spring.mail.scheduler.persistence.enabled=false
spring.mail.scheduler.persistence.redis.enabled=false
spring.mail.scheduler.persistence.redis.embedded=false
spring.mail.scheduler.persistence.redis.host=localhost
spring.mail.scheduler.persistence.redis.port=6381
This error keeps coming :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource [org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
...
Caused by: org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
...
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
...
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connexion refusée (Connection refused)
...
Caused by: java.net.ConnectException: Connexion refusée (Connection refused)
...
Can you provide a way in the documentation to avoid this ?
I don't need the persistence or scheduling layer and don't want to install a redis instance just to send some mails.
Ok, before going further, i will take a look a these examples, maybe i missed something.
Ok, i haven't seen usefull tips to help me.
My pom is with this (when removed, no problem) :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.6.RELEASE</version>
<relativePath/>
</parent>
...
<dependency>
<groupId>it.ozimov</groupId>
<artifactId>spring-boot-email-core</artifactId>
<version>0.5.0</version>
</dependency>
My java code just got this, it's a new project :
@SpringBootApplication
@EnableEmailTools
public class IndustryJarvisApplication {
public static void main(String[] args) {
SpringApplication.run(IndustryJarvisApplication.class, args);
}
}
When i launch i got the above errors.
Ok, it's seems that Spring Boot is trying to auto-configure Redis when we load the spring-boot-email-core dependency.
If we don't want to use Redis we need to exclude it from the auto-configuration.
I've found here the solution :
You can add
spring.session.store-type=none
. It isn't obvious in the doc so I'll update that.
It also 1.4 specific unfortunately. so I am afraid you'll have to exclude the auto-configuration via
properties in 1.3 :
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.session.SessionAutoConfiguration
And it works.
I think it will be an useful tips to put in the documentation.
Thanks for your help.
There's already docs about spring-session, the error was caused by spring-session and spring-boot-starter-data-redis on classpath, it tried to auto-configure as redis http-sessions store.
Maybe @robertotru could fix this issue by implementing the same auto-config that spring-session does when it found redis as dependency. E.g. @EnableRedisHttpSession -> @EnableRedisEmailPersistence.
There's no email-tools error by redis implementation.
@alkaphreak @miguelsauza Got it. I will update the doc as soon as possible, or, you can contribute by updating them by yourself: any Pull Request that fixes the issue is more than welcome :)
I tried to reproduce the error just to stay clear but it's not a problem caused by email-tools. As the first stacktrace line indicates: org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfiguration.class.
That class is part of spring-session module and it tries to auto-configure by OnConditional annotation that found spring-boot-starter-data-redis on classpath.
Thanks a lot for investigating. Yeah your analysis looks convincing. Unfortunately I have no time at the moment to run some tests.
I'll keep this open for correctness.
I'm having the same problem with spring boot 1.5.4. It isn't very obvious, but when using the /health endpoint of spring actuator things break.
For now I've resolved it by excluding the redis dependencies, but that doesn't feel like a real solution:
<exclusions> <exclusion> <artifactId>spring-boot-starter-data-redis</artifactId> <groupId>org.springframework.boot</groupId> </exclusion> <exclusion> <artifactId>embedded-redis</artifactId> <groupId>it.ozimov</groupId> </exclusion> </exclusions>
@evandongen just to know, which OS are you using?
I'm using ubuntu 14.04, running with IntelliJ 2017.1.4 in Tomcat 7.0.751