Skip to content

Unable to obtain SessionCookieConfig #1040

Closed
@lglapinski

Description

Hi!

I have following configuration:

spring - 5.0.5
spring session - 5.0.4
spring session data redis - 2.0.2

During each deployment I see this:

WARN  RedisHttpSessionConfiguration$$EnhancerBySpringCGLIB$$35c2575f:174 - Unable to obtain SessionCookieConfig: Section 4.4 of the Servlet 3.0 specification does not permit this method to be called from a ServletContextListener that was not defined in web.xml, a web-fragment.xml file nor annotated with @WebListener

Configuration:

public class SecurityInitializer extends AbstractSecurityWebApplicationInitializer {
}
public class SessionInitializer extends AbstractHttpSessionApplicationInitializer {
}
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class<?>[]{AppConfig.class, AsyncConfig.class, PersistenceConfig.class, RedisConfig.class,
                SchedulingConfig.class, SecurityConfig.class, WebMvcConfig.class};
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        return null;
    }

    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }

    @Override
    protected Filter[] getServletFilters() {
        return new Filter[]{
                new CharacterEncodingFilter("UTF-8", true)
        };
    }

@Configuration
@EnableRedisHttpSession
public class RedisConfig {
    @Value("${REDIS_ENDPOINT:localhost}")
    private String redisEndpoint;

    @Value("${REDIS_PORT:6379}")
    private Integer redisPort;

    @Bean
    public ConfigureRedisAction configureRedisAction() {
        return ConfigureRedisAction.NO_OP;
    }

    @Bean
    public LettuceConnectionFactory connectionFactory() {
        return new LettuceConnectionFactory(new RedisStandaloneConfiguration(redisEndpoint, redisPort));
    }

    @Bean
    RedisSerializer<Object> springSessionDefaultRedisSerializer() {
        return new CustomRedisSerializer();
    }
}

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions