Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem loading application without the need of REDIS #39

Open
alkaphreak opened this issue Mar 1, 2017 · 11 comments
Open

Problem loading application without the need of REDIS #39

alkaphreak opened this issue Mar 1, 2017 · 11 comments
Assignees
Labels

Comments

@alkaphreak
Copy link

alkaphreak commented Mar 1, 2017

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.

@robertotru
Copy link
Member

robertotru commented Mar 1, 2017

Hi thanks for writing.

The description of the problem is a little bit vague. Can you provide more context, e.g. version used, java code, etc.

By the way, there is an examples folder with several examples working without REDIS.
E.g., have a look at this one.

@alkaphreak
Copy link
Author

Ok, before going further, i will take a look a these examples, maybe i missed something.

@robertotru robertotru self-assigned this Mar 1, 2017
@alkaphreak
Copy link
Author

alkaphreak commented Mar 1, 2017

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.

@alkaphreak
Copy link
Author

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.

@msauza
Copy link

msauza commented Mar 1, 2017

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.

@robertotru
Copy link
Member

robertotru commented Mar 1, 2017

@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 :)

@robertotru robertotru added bug and removed help wanted labels Mar 1, 2017
@robertotru robertotru added this to the Stability - 0.5.x milestone Mar 1, 2017
@msauza
Copy link

msauza commented Mar 9, 2017

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.

@robertotru
Copy link
Member

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.

@evandongen
Copy link

evandongen commented Jun 30, 2017

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>

@robertotru
Copy link
Member

@evandongen just to know, which OS are you using?

@evandongen
Copy link

I'm using ubuntu 14.04, running with IntelliJ 2017.1.4 in Tomcat 7.0.751

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants