2.9. Switching From an Earlier Installation
This chapter explains how to switch an environment that already uses OPENMARU Cluster to the single installation file (openmaru-cluster-valve-all-5.1.0.jar). Read the section that matches what you use now.
| What you use now | Section to read |
|---|---|
The openmaru-cluster-valve-core and openmaru-cluster-valve-hotrod jars plus several library jars in Tomcat's lib | "From Several Jars to One" |
The khan-session-core and khan-session-hotrod jars in the application's WEB-INF/lib, used as a filter | "Switching From the Earlier Version (khan-session)" |
In either case, after the upgrade the session cookie (__KSMSID__) value changes at login, because session fixation protection is now on by default. If an external integration receives and uses this cookie value directly, test the login flow before upgrading. To keep the previous behavior, set sessionFixationProtection to false (see 2.2).
From Several Jars to One
Remove all jars of the previous method from Tomcat's lib and add the new installation file. If the old openmaru-cluster-valve-hotrod jar remains, startup stops with KSM-SJ-002. Remove all other old jars as well.
The replacement script migrate-single-jar.sh does this for you. It is provided together with the installation file.
- It moves only files whose names exactly match the file name lists in the script. Even if Tomcat's
libis shared with other products, other files are not touched. - It does not delete files; it moves them to a backup directory, so you can always roll back.
- It leaves
jamm-0.2.5.jarin place. This file is used for measuring session memory usage (-javaagent). If you do not use that feature, you can delete it yourself.
Procedure
-
Stop Tomcat.
-
Check which files will be moved. Nothing is changed; only the list is shown.
bin/migrate-single-jar.sh "$CATALINA_BASE/lib"- Review the list of jars to be moved.
- If another product that shares the same
libuses a jar with the same name, keep it with--keep. It can be given more than once. Example:--keep slf4j-api-1.7.36.jar - Files shown under remaining old jars are earlier OPENMARU Cluster jars that are not in the lists. The script does not move them, so remove them yourself.
-
Back up and switch.
bin/migrate-single-jar.sh --apply --new-jar openmaru-cluster-valve-all-5.1.0.jar "$CATALINA_BASE/lib"- The backup is created in the parent directory of
libasopenmaru-migrate-backup-<time>. To put it elsewhere, use--backup-dir <path>(not insidelib). - The backup directory also holds the
liblisting before the switch (lib-before.txt) and the list of moved files (moved.txt). Write down the backup location printed in the output. You need it to roll back.
- The backup is created in the parent directory of
-
In
conf/logging.properties, prefix log names starting withorg.infinispanorio.nettywithio.openmaru.shaded.. If the WAS startup options contain-Dio.netty.*or-Dorg.jboss.logging.*, change them the same way (see "Adjusting Log Levels" and "Netty System Properties" in 2.7). -
Start Tomcat and check that the startup log contains the following line.
bundled infinispan=13.0.11.Final-redhat-00001 netty=4.1.128.Final-redhat-00001 prefix=io.openmaru.shaded. jar=file:/…/openmaru-cluster-valve-all-5.1.0.jar mode=singleIf this line is missing or shows
prefix=none mode=multi, an old jar was loaded first. IfKSM-SJ-002appears, remove the jars listed inold=[…]in the log.
Caution The script also moves the
slf4j-apiandslf4j-jdk14jars. The new installation file does not need these libraries separately. If an application was borrowing slf4j from Tomcat'slib,NoClassDefFoundError: org/slf4j/…occurs after the switch. In that case, add slf4j to the application'sWEB-INF/lib, or keep it in step 2 with--keep slf4j-api-1.7.36.jar.
Rolling Back
-
Stop Tomcat.
-
Roll back using the backup location you wrote down in step 3.
bin/migrate-single-jar.sh --restore --backup-dir <backup location> "$CATALINA_BASE/lib"The new installation file is moved to
new-jar/in the backup, and the moved jars return tolib. If a file with the same name already exists inlib, nothing is moved and the script stops. If you used--force-dirwhen moving, add it when rolling back as well. -
Restore
logging.propertiesand the startup options by hand. -
Start Tomcat.
Script Options
| Option | What it does |
|---|---|
| (none) | Shows only what would be moved (default) |
--apply | Moves the target jars to the backup directory |
--new-jar <file> | Copies the new installation file into lib during --apply. Without it, only the old jars are moved and you copy the new file yourself |
--restore --backup-dir <path> | Returns the moved jars and moves the new installation file into the backup |
--backup-dir <path> | Backup location (must be outside lib) |
--keep <file name> | Does not move this file. Can be given more than once |
--force-dir | Also targets a directory that does not look like Tomcat's lib (for example, an application's WEB-INF/lib) |
Switching From the Earlier Version (khan-session)
The earlier version put khan-session-core-<version>.jar, khan-session-hotrod-<version>.jar, and library jars in the application's WEB-INF/lib and was used as a filter. In the new version the class names (packages) have changed and there is a single installation file. Setting names are unchanged.
What Changes
| What | Earlier version | New version |
|---|---|---|
| Installation files | khan-session-core, khan-session-hotrod, and several library jars | A single openmaru-cluster-valve-all-5.1.0.jar |
| Filter class | com.opennaru.khan.session.filter.InfinispanHotRodSessionFilter | io.openmaru.cluster.filter.InfinispanHotRodSessionFilter (Tomcat 10 or later: io.openmaru.cluster.jakarta.filter.…) |
| Listener | com.opennaru.khan.session.listener.SessionListener registered in web.xml | Registered automatically (remove it from web.xml). Spring Boot registers it explicitly |
| Imports in application code | com.opennaru.khan.session.listener.SessionLoginManager | io.openmaru.cluster.listener.SessionLoginManager (Tomcat 10 or later: io.openmaru.cluster.jakarta.listener.…) |
| Allow list | com.opennaru.khan.session classes | io.openmaru.cluster.KhanSessionMetadata |
| Spring Boot configuration | Constants such as Constants.SESSION_TIMEOUT | Strings such as "sessionTimeout" (same as the web.xml names) |
| Installation methods | Filter only | On Tomcat, the Valve method is also available |
Procedure
- Remove the
khan-session-*jars and the library jars that came with them from the application'sWEB-INF/lib. Keep libraries the application uses directly. Also remove the build dependency (com.opennaru.khan:khan-session-hotrod). - Choose an installation method and add the new installation file (step 1 of 2.1 "Installation").
- To keep using the filter method, put it in
WEB-INF/lib. - To switch to the Tomcat Valve method, put it in Tomcat's
liband remove the filter registration fromweb.xml.
- To keep using the filter method, put it in
- Change
<filter-class>inweb.xmlto the new class name and remove the<listener>line forSessionListener. Leave the<init-param>entries as they are. - Change the
com.opennaru.khan.session.imports in application code toio.openmaru.cluster.(Tomcat 10 or later:io.openmaru.cluster.jakarta.) and rebuild. - In the allow list (
java_serial_allowlist) inhotrod.properties, replace thecom.opennaru.khan.sessionentry withio.openmaru.cluster.KhanSessionMetadata(see 2.7). The server list separator is;. - Deploy the application and confirm it with step 4 of 2.1.
Caution Plan on the assumption that sessions stored by the earlier version are not carried over after the switch. Users may need to log in again, so switch when traffic is low.