I haven't been able to find any guide on how to programmatically setup tomcat session replication when using an embedded tomcat with spring boot. It was even a hard time finding out about the "tomcat-catalina-ha" dependency.
I have a working Tomcat session replication example working when setup on a non-embedded tomcat, but converting it over to Java config hasn't been working. I looked into Hazelcast, but a few of the options I need require the enterprise license. I've also been told that storing sessions in a traditional database doesn't scale well.
I'm looking for a guide or example project that implements Tomcat session replication using an embedded tomcat. Barring that, I'd be interested in why there are no guides in the first place?
So after more research, I found this documentation:
Looking through the mailing list archive, I was able to find one example of programmatic cluster configuration: https://marc.info/?l=tomcat-user&m=160220406421937&w=2
It was able to take me most of the way, I had been setting my cluster on the context via:
When I set the cluster on the context, none of the cluster elements were ever actually started.
I would also note that when investigating this, I found an article(2013) showing how to load a
server.xmlwhen using an embedded tomcat, although I didn't not try it.Final note: I used the
StaticMembershipServicevs the multicast stuff, or theStaticMembershipInterceptor.