diff --git a/src/main/java/com/radiadesign/catalina/session/RedisSessionManager.java b/src/main/java/com/radiadesign/catalina/session/RedisSessionManager.java index bacad8bd..8c338cd4 100644 --- a/src/main/java/com/radiadesign/catalina/session/RedisSessionManager.java +++ b/src/main/java/com/radiadesign/catalina/session/RedisSessionManager.java @@ -178,15 +178,23 @@ protected synchronized void startInternal() throws LifecycleException { setState(LifecycleState.STARTING); + Boolean attachedToValve = false; for (Valve valve : getContainer().getPipeline().getValves()) { if (valve instanceof RedisSessionHandlerValve) { this.handlerValve = (RedisSessionHandlerValve) valve; this.handlerValve.setRedisSessionManager(this); log.info("Attached to RedisSessionHandlerValve"); + attachedToValve = true; break; } } + if (!attachedToValve) { + String error = "Unable to attach to session handling valve; sessions cannot be saved after the request without the valve starting properly."; + log.fatal(error); + throw new LifecycleException(error); + } + try { initializeSerializer(); } catch (ClassNotFoundException e) {