Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] File session store: Unwriteable session

On 2022-08-15T08:40:04 +1000
Jan Bartel <janb@xxxxxxxxxxx> wrote:

> Hi Mark,
> 
> The jetty doco shows you how to correctly set up a DefaultSessionIdManager
> in code:
> https://www.eclipse.org/jetty/documentation/jetty-10/programming-guide/index.html#pg-server-session-architecture
> 
> I think what is happening is that your code is creating the
> DefaultSessionIdManager, but not adding it to the Server with the
> setSessionIdManager call, and thus it is not being started - it is in
> startup that it works out what it's unique nodeid is, which is null in your
> stacktrace.
> 
> If you don't want to do any explicit setup of the DefaultSessionIdManager,
> you don't even have to create one yourself: the SessionHandler will create
> one on startup (if it can't find one via the Server instance).
> 
> I might add a log warning or exception if a non-initialized
> DefaultSessionIdManager is used, to make the problem more obvious.

Thank you! That does seem to have been the problem.

If you don't mind me saying, that's a pretty unfortunate bit of API
design. This is incorrect:

  final var sessionIds = new DefaultSessionIdManager(server);

... Whilst this is correct:

  final var sessionIds = new DefaultSessionIdManager(server);
  server.setSessionIdManager(sessionIds);

It's not great that I specified the server when creating the ID
manager, but then had to set the ID manager on the server anyway,
and things broke in strange ways when I failed to do so.

-- 
Mark Raynsford | https://www.io7m.com



Back to the top