Our application stack is hibernate/spring / spring security/JSF running inside tomcat 7.
We want to configure Terracotta DSO. we are using spring security SessionRegistryImpl.java to get session information on logged in users, but this class is not serializable and thus our session becomes unserializable.
Due to which i constantly get java.io.NotSerializableException for the above spring class.
Is it possible to do clustering with Terracotta in this case?
I have downloaded and installed the Open source Terracotta 3.6.2.
I Followed the following documentations
http://terracotta.org/documentation/web-sessions/installation-guide
http://terracotta.org/documentation/terracotta-dso/dso-install
Configured tc-config.xml following http://docs.terracotta.org/confluence/display/docs/Configuration+Guide+and+Reference
We have the following jars in our application
Code:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>org.terracotta</groupId>
<artifactId>terracotta-toolkit-1.5-runtime</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.terracotta.session</groupId>
<artifactId>terracotta-session</artifactId>
<version>1.2.2</version>
</dependency>
I performed tim-get.bat install on tomcat7, ehcache, spring-security
Code:
<module name="tim-tomcat-7.0"/>
<module name="tim-spring-security-2.0" />
<module name="tim-ehcache-1.7" />
EHCACHE
Since we are using ehcache in our application, we thought we should configure it to make everything work together. Please find below our ehcache.xml
when ehcache-terracotta.jar is missing it throws the following error net.sf.ehcache.CacheException: Terracotta cache classes are not available, you are missing jar(s) most likely
I read that for DSO configuration, we should not have this jar in application path.
So at the moment the serialization does not work and ehcache complains.
Any hints on where I am making mistakes.
tc-config.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-5.xsd"
xmlns:tc="http://www.terracotta.org/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server host="localhost" name="localhost:9510" bind="0.0.0.0">
<dso-port bind="10.7.65.31">9510</dso-port>
<jmx-port bind="10.7.65.31">9520</jmx-port>
<data>C:/Terracotta/terracotta/server-data</data>
<logs>C:/Terracotta/terracotta/server-logs</logs>
<index>C:/Terracotta/terracotta/server-index</index>
<statistics>C:/Terracotta/terracotta/server-statistics</statistics>
<dso>
<client-reconnect-window>120</client-reconnect-window>
<persistence>
<mode>temporary-swap-only</mode>
<offheap>
<enabled>false</enabled>
<maxDataSize>5g</maxDataSize>
</offheap>
</persistence>
</dso>
</server>
</servers>
<clients>
<logs>C:/Terracotta/terracotta/client-logs/</logs>
<modules>
<module name="tim-tomcat-7.0"/>
<module name="tim-spring-security-2.0" />
<module name="tim-ehcache-1.7" />
<!--<module name="tim-quartz-2.0" />
<module group-id="org.terracotta.toolkit" name="terracotta-toolkit-1.5" />-->
</modules>
<dso>
<debugging>
<instrumentation-logging>
<class>true</class>
<locks>false</locks>
<transient-root>true</transient-root>
<roots>true</roots>
<distributed-methods>false</distributed-methods>
</instrumentation-logging>
<runtime-logging>
<non-portable-dump>true</non-portable-dump>
<lock-debug>true</lock-debug>
<wait-notify-debug>false</wait-notify-debug>
<distributed-method-debug>false</distributed-method-debug>
<new-object-debug>true</new-object-debug>
<named-loader-debug>false</named-loader-debug>
</runtime-logging>
<runtime-output-options>
<auto-lock-details>true</auto-lock-details>
<caller>true</caller>
<full-stack>false</full-stack>
</runtime-output-options>
</debugging>
</dso>
</clients>
<application>
<dso>
<instrumented-classes>
<include>
<class-expression>org.springframework.*</class-expression>
<honor-transient>true</honor-transient>
</include>
<include>
<class-expression>org.springframework..*</class-expression>
<honor-transient>true</honor-transient>
</include>
<include>
<class-expression>org.springframework...*</class-expression>
<honor-transient>true</honor-transient>
</include>
<include>
<class-expression>org.springframework.security.core.session.*</class-expression>
<honor-transient>true</honor-transient>
</include>
</instrumented-classes>
<locks>
<autolock auto-synchronized="true">
<method-expression>* org.springframework.security.core.session.SessionRegistryImpl.re*(..)</method-expression>
</autolock>
</locks>
<roots>
<root>
<field-name>org.springframework.security.core.session.SessionRegistryImpl.principals</field-name>
<root-name>PRINCIPALS</root-name>
</root>
<root>
<field-name>org.springframework.security.core.session.SessionRegistryImpl.sessionIds</field-name>
<root-name>SESSIONIDS</root-name>
</root>
</roots>
<injected-instances>
<injected-field>
<field-name>org.springframework.security.core.session.SessionRegistryImpl.principals</field-name>
</injected-field>
<injected-field>
<field-name>org.springframework.security.core.session.SessionRegistryImpl.sessionIds</field-name>
</injected-field>
</injected-instances>
<web-applications>
<web-application serialization="false">nymphaea</web-application>
</web-applications>
<dso-reflection-enabled>false</dso-reflection-enabled>
</dso>
</application>
</tc:tc-config>
ehcache.xml
Code:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd"
updateCheck="true" monitoring="autodetect"
dynamicConfig="true">
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="50000"
eternal="false"
timeToIdleSeconds="900"
timeToLiveSeconds="1200"
>
<terracotta clustered="true" valueMode="identity"/>
</defaultCache>
<cache name="ContentHierarchyNode"
maxElementsInMemory="500000"
eternal="false"
timeToIdleSeconds="900"
timeToLiveSeconds="21600"
/>
<cache name="ForumHierarchyNode"
maxElementsInMemory="500000"
eternal="false"
timeToIdleSeconds="900"
timeToLiveSeconds="21600"
/>
</ehcache>
Choesang Tenzin