Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Trying to get jdbc sessions/failover working on Jetty 9.4.3 - ideas?

Hi,
"NotSerializableException messages in our application logs"
Can you provide more details? Stacktrace?
This happen when Jetty try to serialize your session. So might an issue with the data you're storing within your session.
Cheers
Olivier

On Thu, Jun 29, 2017 at 1:32 AM, Scott Tatum <setatum@xxxxxxxxx> wrote:

My environment:

- 3 servers running Windows 2008 R2 Standard (16 cores, 16g RAM)
- Servers fronted with a Netscaler appliance (v12) with session persistence enabled, meaning once a session is established and sent to a particular node, subsequent requests from that client keep getting sent to the same node unless/until that node goes down. 
- Java 1.8.0_131
- Jetty 9.4.6.v20170531

With this configuration we can run our application (a Vaadin+Spring-based war deployed in Jetty), and if a node goes down that has user sessions on it, those users gets logged out as they are rerouted to another available node. I want to use Jetty JDBC sessions to provide a failover mechanism where user sessions will persist when users are moved from one node to another in such a scenario.

I followed the instructions that I found on the documentation site on setting up JDBC sessions:


Basically, this is my setup:

- Did a standard install of Jetty with a separate jetty.home/jetty.base.
- Put the latest mysql JDBC driver under jetty.base/lib/ext.
- Edited server.ini and set jetty.defaultSessionIdManager.workerName to a unique name on each server.
- Edited sessions.ini and set jetty.sessionIdManager.workerName to the same unique name on each server.
- Edited session-store-jdbc.ini and used the following configuration:

db-connection-type=driver
jetty.session.jdbc.driverClass=com.mysql.jdbc.Driver
jetty.session.jdbc.driverUrl=jdbc:mysql://192.168.1.100/db_name?user=jetty

Database IP and name changed to protect the innocent. I also set custom names for the schema table/column names, simply because I didn't want mixed case names in MySQL.

In MySQL I created a jetty user with access to the appropriate database and with no password (all my attempts to require a password and then set it in the URL failed).

With this configuration, the server nodes come up fine and don't give any errors. In the database I can see a single table being created called jetty_sessions (that was my renamed table name). It has all the columns in it I expected. When I use my application on any of the servers, I do see entries being inserted into the table, and the correct unique node names are being prepended to the front of the session ID's. I do also see a couple of NotSerializableException messages in our application logs, strangely enough on objects that shouldn't even be in the session. But the app itself seems to work fine, no issues.

However, if I have a session on one of the nodes and stop that node, the users are logged out when they are sent to another node, just as if I had not enabled JDBC sessions.

My reading of the above documentation seemed to indicate that this was all I needed to do to enable a failover type setup. Indeed, it seems to be using the database, but not providing the failover protection I expected. Is there something I am missing, or something I have done wrong? Any advice would be helpful. Thanks.

-Scott

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Olivier

Back to the top