Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Redis session management cause jetty-runner to fail on startup

John,

The first thing to note is that the jetty-runner has been languishing for a long time, we were even thinking of removing it in a future release. Of course, if the user community is actually finding the jetty runner useful, then that would be good to know and we can redirect some resources its way.

As for redis sessions, sorry but I'm not familiar with them at all. The first thing I would try is running your configurations in the jetty distro to verify you have everything set up correctly and working, then you can port that over to using the jetty-runner. Also ensure that you have debug level turned up (-Dorg.eclipse.jetty.server.session.LEVEL=DEBUG).

Jan

On Sat, 4 Jan 2020 at 09:58, John Ruggentaler <john.ruggentaler@xxxxxxxxx> wrote:
What would cause the following exception when session management is configured with jetty-runner on startup?

2020-01-03 16:27:56.206:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=7178ms
2020-01-03 16:27:56.214:DBUG:oejs.session:main: SessionManager default maxInactiveInterval=1800
2020-01-03 16:27:56.216:DBUG:oejs.session:main: SessionManager default maxInactiveInterval=1800
2020-01-03 16:27:56.223:INFO:oejshC.ROOT:main: No Spring WebApplicationInitializer types detected on classpath
2020-01-03 16:27:56.517:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
2020-01-03 16:27:56.517:INFO:oejs.session:main: No SessionScavenger set, using defaults
2020-01-03 16:27:56.519:DBUG:oejs.session:main: Using own scheduler for scavenging
2020-01-03 16:27:56.519:INFO:oejs.session:main: node0 Scavenging every 660000ms
2020-01-03 16:27:56.655:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.w.WebAppContext@737996a0{/tavconnect-production-1512-md1,/,file:///Users/me/jetty/tmpdir/jetty-0_0_0_0-8080-tavconnect-production-1512-md1_war-_-any-2325432774449264012.dir/webapp/,UNAVAILABLE}{current.war}
java.lang.IllegalStateException: No SessionContext
at org.eclipse.jetty.server.session.AbstractSessionDataStore.doStart(AbstractSessionDataStore.java:192)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
at org.eclipse.jetty.server.session.AbstractSessionCache.doStart(AbstractSessionCache.java:213)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:100)
at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:120)
at org.eclipse.jetty.server.session.SessionHandler.doStart(SessionHandler.java:504)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:100)
at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:120)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:880)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:356)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1445)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1409)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:822)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:275)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:100)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:100)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at org.eclipse.jetty.server.Server.start(Server.java:407)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:100)
at org.eclipse.jetty.server.Server.doStart(Server.java:371)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at org.eclipse.jetty.runner.Runner.run(Runner.java:520)
at org.eclipse.jetty.runner.Runner.main(Runner.java:565)
2020-01-03 16:27:56.656:INFO:oejs.RequestLogWriter:main: Opened /Users/johnruggentaler/logs/2020_01_03-requests.log
2020-01-03 16:27:56.671:INFO:oejs.AbstractConnector:main: Started ServerConnector@6fdb1f78{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2020-01-03 16:27:56.672:INFO:oejs.Server:main: Started @20115ms
2020-01-03 16:38:56.532:DBUG:oejs.session:Session-HouseKeeper-4135c3b-1: node0 scavenging sessions

OS version: Mac OS Catalina 10.15.2
jetty-runner version: 9.4.25.v20191220
Java version: 1.8.0_232

Here is my context.xml
<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<Configure class="org.eclipse.jetty.webapp.WebAppContext">

  <Set name="contextPath">/</Set>
  <Set name="war">current.war</Set>

  <Set name="securityHandler">
    <New class="org.eclipse.jetty.security.ConstraintSecurityHandler">
      <Set name="sessionRenewedOnAuthentication">false</Set>
    </New>
  </Set>

  <Call id="sh" name="getSessionHandler">
    <Set name="sessionCache">
      <New class="org.eclipse.jetty.server.session.DefaultSessionCache">
        <Arg><Ref id="sh"/></Arg>
        <Set name="sessionDataStore">
           <New class="org.eclipse.jetty.redis.session.RedisSessionDataMap">
            <Arg>localhost</Arg>
            <Arg>6379</Arg>
            <Set name="database">0</Set>
            <Set name="expirySec">0</Set>
            <Set name="keyPrefix">session:</Set>
           </New>
        </Set>
      </New>
    </Set>
  </Call>

</Configure>

I downloaded jetty-redis-sessions and modified RedisSessionDataMap see attachment. I built the jetty-redis-sessions jar and included it in my lib directory. In the constructor I logged the Host and port to verify the constructor is called,...
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users


--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
Expert assistance from the creators of Jetty and CometD


Back to the top