demo4.zip
<https://drive.google.com/file/d/1XOUHhw59Djk2XmdFEmkBsusnHf5_yNE7/view?usp=drive_web>
Hello,

Specifications
Windows 10
Tomcat 8.5
this is a configuration question .
the tomcat specification that works :
https://tomcat.apache.org/tomcat-8.0-doc/config/manager.html

Im trying to configure correctly in 2 different applications : Persistent
Manager Implementation using a mysqldb as a datasource.

In one of them that is a legacy project i have some dependencies as

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>${spring.framework.version}</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>${spring.framework.version}</version>
</dependency>

and it is already doing the registry of the sessions in my bd.
but in the other app im using a spring boot with the same configuration.
I'm not able to see any registration of the sessions in my db. After the
deploy of my app in a tomcat server and hit any resource example
/test/resource im able to see the response correctly but i just want to
know if this  Persistent Manager Implementation is only for legacy apps? or
why is running in one and in the other is not.

this is my xml for both

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/nose" docBase="nose"
reloadable="true" useHttpOnly="true"  cookies="${uses.cookies}" >

        <Manager
className="org.apache.catalina.session.PersistentManager"
maxInactiveInterval="3600" debug="0" saveOnRestart="true"
maxActiveSessions="-1" minIdleSwap="1" maxIdleSwap="2"
maxIdleBackup="1" >
            <Store className="org.apache.catalina.session.JDBCStore"
                   dataSourceName="jdbc/tomcat"
                   driverName="com.mysql.jdbc.Driver"
                   sessionAppCol="app_name"
                   sessionDataCol="session_data"
                   sessionIdCol="session_id"
                   sessionLastAccessedCol="last_access"
                   sessionMaxInactiveCol="max_inactive"
                   sessionTable="tomcat_sessions"
                   sessionValidCol="valid_session"
            />
        </Manager>

    <Resource
            name="jdbc/tomcat"
            auth="Container"
            type="javax.sql.DataSource"
            factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
            initialSize="${jdbc.pool.initialSize}"
            maxActive="${jdbc.pool.maxActive}"
            maxIdle="${jdbc.pool.maxIdle}"
            minIdle="${jdbc.pool.minIdle}"
            suspectTimeout="${jdbc.pool.suspectTimeout}"
            maxWait="${jdbc.pool.maxWait}"
            
timeBetweenEvictionRunsMillis="${jdbc.pool.timeBetweenEvictionRunsMillis}"
            minEvictableIdleTimeMillis="${jdbc.pool.minEvictableIdleTimeMillis}"
            validationQuery="select 1"
            validationInterval="${jdbc.pool.validationInterval}"
            testOnBorrow="true"
            removeAbandoned="true"
            removeAbandonedTimeout="${jdbc.pool.removeAbandonedTimeout}"
            logAbandoned="true"
            
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"
            testWhileIdle="true"
            username="${jdbc.username}"
            password="${jdbc.password}"
            driverClassName="com.mysql.jdbc.Driver"
            
url="jdbc:mysql://${jdbc.host}:${jdbc.port}/tomcat?autoReconnect=true"/>
    jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
    org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;
    org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"

these 2  are the guides where i learn the mayority how to do it
https://svn.apache.org/repos/asf/tomcat/archive/tc4.1.x/trunk/container/catalina/docs/JDBCStore-howto.html
https://gerrytan.wordpress.com/2013/08/21/tomcat-7-jdbc-session-persistence/

im going to attach the code that im trying to know why is not working.

Reply via email to