Estou trabalhando na adição de persistência de sessão no Tomcat com o MySQL, mas infelizmente isso não está funcionando. Nada no banco de dados. Eu estou tentando salvar informações de sessão para que os usuários estejam conectados mesmo após o reinício do tomcat. Esta é a configuração que tenho:
tabela:
create database tomcat;
create table tomcat$sessions
(
id varchar(100) not null primary key,
valid char(1) not null,
maxinactive int not null,
lastaccess bigint,
data mediumblob
);
context.xml:
<Manager className="org.apache.catalina.session.PersistentManager" debug="3" saveOnRestart="true" maxActiveSessions="-1"
minIdleSwap="-1" maxIdleSwap="-1" maxIdleBackup="-1">
<Store className="org.apache.catalina.session.JDBCStore"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/tomcat?user=USERNAME&password=PASSWORD&useSSL=false"
sessionTable="tomcat$sessions"
sessionIdCol="id"
sessionDataCol="data"
sessionValidCol="valid"
sessionMaxInactiveCol="maxinactive"
sessionLastAccessedCol="lastaccess"
checkInterval="60"
debug="99" />
</Manager>
logging.properties:
# To see debug messages in TldLocationsCache, uncomment the following line:
#org.apache.jasper.compiler.TldLocationsCache.level = FINE
org.apache.catalina.session.PersistentManager.level = ALL
org.apache.catalina.session.PersistentManager.useParentHandlers = true
org.apache.catalina.session.level = ALL
org.apache.catalina.session.useParentHandlers = true
catalina.out:
Feb 17, 2017 2:24:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: Start expire sessions PersistentManager at 1487337861731 sessioncount 1
Feb 17, 2017 2:24:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: End expire sessions PersistentManager processingTime 16 expired sessions: 0
Feb 17, 2017 2:25:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: Start expire sessions PersistentManager at 1487337921759 sessioncount 1
Feb 17, 2017 2:25:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: End expire sessions PersistentManager processingTime 13 expired sessions: 0
Feb 17, 2017 2:26:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: Start expire sessions PersistentManager at 1487337981776 sessioncount 1
Feb 17, 2017 2:26:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: End expire sessions PersistentManager processingTime 9 expired sessions: 0
Feb 17, 2017 2:27:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: Start expire sessions PersistentManager at 1487338041789 sessioncount 1
Feb 17, 2017 2:27:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: End expire sessions PersistentManager processingTime 16 expired sessions: 0
Feb 17, 2017 2:28:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: Start expire sessions PersistentManager at 1487338101809 sessioncount 1
Feb 17, 2017 2:28:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: End expire sessions PersistentManager processingTime 15 expired sessions: 0
Feb 17, 2017 2:29:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: Start expire sessions PersistentManager at 1487338161833 sessioncount 1
Feb 17, 2017 2:29:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: End expire sessions PersistentManager processingTime 15 expired sessions: 0
Feb 17, 2017 2:30:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: Start expire sessions PersistentManager at 1487338221852 sessioncount 1
Feb 17, 2017 2:30:21 PM org.apache.catalina.session.PersistentManagerBase processExpires
FINE: End expire sessions PersistentManager processingTime 14 expired sessions: 0
Feb 17, 2017 2:30:34 PM org.apache.catalina.core.StandardServer await
INFO: A valid shutdown command was received via the shutdown port. Stopping the Server instance.
catalina.sh:
CATALINA_OPTS="$CATALINA_OPTS -server -Xms3g -XX:+UseParallelGC -XX:ParallelGCThreads=2 -Dspring.security.strategy=MODE_INHERITABLETHREADLOCAL -Dorg.apache.catalina.session.StandardSession.ACTIVITY_CHECK=true"
Tags mysql tomcat session linux apache-2.2