problem getting persistentmanager to work in tomee9

36 Views Asked by At

After upgrade from tomee8 to tomee9 the session management "persistent.manager" writes following error in catalina log:

21-Jun-2023 13:22:21.003 WARNING [Catalina-utility-2] org.apache.catalina.core.StandardContext.backgroundProcess Exception processing manager [PersistentManager[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myapplication]]] background process java.lang.IllegalStateException: No data source available

The old context.xml looked like this

<!-- Default set of monitored resources. If one of these changes, the    -->
<!-- web application will be reloaded.                                   -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>

<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<!-- JDBC Information from IaC will be below -->
        
<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="true" maxActiveSessions="-1" minIdleSwap="-1" maxIdleSwap="-1" maxIdleBackup="20">
    <Store className="org.apache.catalina.session.JDBCStore"
        driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
        connectionURL="jdbc:sqlserver://mydatabase:1433;databaseName=TomcatSession;user=TomcatSession;password=password;sslConnection=true;encrypt=true;trustServerCertificate=true"
        sessionTable="Sessions"
        sessionIdCol="session_id"
        sessionDataCol="session_data"
        sessionValidCol="valid_session"
        sessionMaxInactiveCol="max_inactive"
        sessionLastAccessedCol="last_access"
        sessionAppCol="app_name"
        />
</Manager>
and the new context.xml like this
<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="true" maxActiveSessions="-1" minIdleSwap="-1" maxIdleSwap="-1" maxIdleBackup="20">
    <Store className="org.apache.catalina.session.DataSourceStore"
        driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
        connectionURL="jdbc:sqlserver://mydatabase:1433;databaseName=TomcatSession;user=TomcatSession;password=password;sslConnection=true;encrypt=true;trustServerCertificate=true"
        sessionTable="Sessions"
        sessionIdCol="session_id"
        sessionDataCol="session_data"
        sessionValidCol="valid_session"
        sessionMaxInactiveCol="max_inactive"
        sessionLastAccessedCol="last_access"
        sessionAppCol="app_name"
        />
</Manager> -->

tried changing the content of context.xml as above

0

There are 0 best solutions below