Hi,

We have our CAS(3.5.2) environment load balanced and  Ehcache for ticket 
registry configured to do manual peer discovery for ticket replication. I am 
running into a situation where service ticket fails validation in one of the 
scenario. I have listed the scenarios below : 

Start CAS server 1
Start CAS server 2
Access a CASified application, flows redirects to CAS login page, log into the 
application

Scenario 1:
Service ticket created on server 1 successfully
Service ticket validated on server 1 successfully

Scenario 2:
Service ticket created on server 2 successfully
Service ticket validated on server 2 successfully

Scenario 3:
Service ticket created on server 2 successfully
Service ticket validated on server 1 successfully

Scenario 4:
Service ticket gets created on server 1 successfully
Service ticket validation fails on server 2
During this time, (from the log files) when server 2 receives the service 
ticket, service ticket is already expired.

Scenario 5:
Restart only server 1, access casified application;
Scenario 1 & 2 are successful
Service ticket created on server 1 is validated on server 2 successfully
Service ticket created on server 2 fails validation on server 1 (scenario 3 and 
4 are switched)

I increased the ST expiration time from 10 secs to 1 min and I still see the 
same behavior. I see the behavior bounce between server 1 & 2 when they are 
restarted in sequence (start server 1, server 2 has the issue, restart server 2 
now issue jumps to server 1 and so on)  

Has anyone else encountered this kind of behavior? Is my ehcache configuration 
wrong? 

Any idea what I am doing wrong? I have attached the ticketRegistry and 
ehcache-replication for reference. 

Thanks,
Rakesh


-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xmlns:p="http://www.springframework.org/schema/p";
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd";>

    <description>
            Configuration for the EhCache TicketRegistry which stores the tickets in a distributed EhCache and cleans
            them out as specified intervals.
    </description>

    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
            <property name="configLocation" value="classpath:ehcache-replicated.xml" />
            <property name="shared" value="true" />
            <property name="cacheManagerName" value="ticketRegistryCacheManager" />
    </bean>

    <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
            <property name="locateExistingServerIfPossible" value="true" />
    </bean>

    <bean id="managementService" class="net.sf.ehcache.management.ManagementService" init-method="init" destroy-method="dispose">
        <constructor-arg ref="cacheManager" />
        <constructor-arg ref="mbeanServer" />
        <constructor-arg value="true" />
        <constructor-arg value="true" />
        <constructor-arg value="true" />
        <constructor-arg value="true" />
    </bean>

    <bean id="ticketRegistry"
          class="org.jasig.cas.ticket.registry.EhCacheTicketRegistry"
          p:serviceTicketsCache-ref="serviceTicketsCache"
          p:ticketGrantingTicketsCache-ref="ticketGrantingTicketsCache" />

    <bean id="abstractTicketCache" abstract="true"
      class="org.springframework.cache.ehcache.EhCacheFactoryBean"
      p:cacheManager-ref="cacheManager"
      p:diskExpiryThreadIntervalSeconds="0"
      p:diskPersistent="false"
      p:eternal="false"
      p:maxElementsInMemory="10000"
      p:maxElementsOnDisk="20000"
      p:memoryStoreEvictionPolicy="LRU"
      p:overflowToDisk="true"
      p:bootstrapCacheLoader-ref="ticketCacheBootstrapCacheLoader" />

    <bean id="serviceTicketsCache"
      class="org.springframework.cache.ehcache.EhCacheFactoryBean"
      parent="abstractTicketCache"
      p:cacheName="cas_st"
      p:timeToIdle="0"
      p:timeToLive="300"
      p:cacheEventListeners-ref="ticketRMISynchronousCacheReplicator" />

    <bean id="ticketGrantingTicketsCache"
      class="org.springframework.cache.ehcache.EhCacheFactoryBean"
      p:cacheName="cas_tgt"
      p:timeToIdle="0"
      p:timeToLive="7201"
      p:cacheEventListeners-ref="ticketRMIAsynchronousCacheReplicator"
      p:bootstrapCacheLoader-ref="ticketCacheBootstrapCacheLoader" />

    <bean id="ticketRMISynchronousCacheReplicator" class="net.sf.ehcache.distribution.RMISynchronousCacheReplicator">
         <constructor-arg name="replicatePuts" value="true" />
         <constructor-arg name="replicatePutsViaCopy" value="true" />
         <constructor-arg name="replicateUpdates" value="true" />
         <constructor-arg name="replicateUpdatesViaCopy" value="true" />
         <constructor-arg name="replicateRemovals" value="true" />
    </bean>

    <bean id="ticketRMIAsynchronousCacheReplicator" class="net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator" parent="ticketRMISynchronousCacheReplicator">
        <constructor-arg name="replicationInterval" value="10000" />
        <constructor-arg name="maximumBatchSize" value="100" />
    </bean>

    <bean id="ticketCacheBootstrapCacheLoader" class="net.sf.ehcache.distribution.RMIBootstrapCacheLoader">
        <constructor-arg name="asynchronous" value="true" />
        <constructor-arg name="maximumChunkSize" value="5000000" />
    </bean>

</beans>
<ehcache name="ehCacheTicketRegistryCache"
    updateCheck="false"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd";>

    <diskStore path="java.io.tmpdir/cas"/>

    <!-- Manual Peer Discovery -->

    <cacheManagerPeerProviderFactory
        class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
        properties="peerDiscovery=manual,
                rmiUrls=//p2.iit.edu:41001/cas_st|//p2.iit.edu:41001/cas_tgt"
                propertySeparator="," />

    <cacheManagerPeerListenerFactory
            class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
            properties="port=41001,
            remoteObjectPort=41002,
            socketTimeoutMillis=5000"
            propertySeparator="," />
</ehcache>

Reply via email to