I'm having trouble getting EhCacheTicketRegistry configured in a cas 4.2.4 
overlay.

This is a two node cluster.  I have two obvious problems: first, TGTs 
issued by one node aren't validated by the other, and second the TGT 
cacheManager is set to __DEFAULT__ where it should be the same as the ST 
cache.

I did find an older post on this topic, and have already applied the 
change, which was include
parent="abstractTicketCache"

on the ticketGrantingTicketsCache bean.  This unfortunately didn't help my 
case.

CAS info;
******************** Welcome to CAS *******************
CAS Version: 4.2.4
Build Date/Time: 2016-07-29T02:26:18.000-05:00
Java Home: /usr/lib/jvm/java-1.7.0-oracle-1.7.0.101.x86_64/jre
Java Vendor: Oracle Corporation
Java Version: 1.7.0_101
OS Architecture: amd64
OS Name: Linux
OS Version: 2.6.32-642.el6.x86_64
*******************************************************

CAS log filtered for EhCacheTicketRegistry:
2016-08-23 15:56:46,542 INFO [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - Setting up Ehcache Ticket Registry...
2016-08-23 15:56:46,542 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - serviceTicketsCache.maxElementsInMemory=10000
2016-08-23 15:56:46,542 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - serviceTicketsCache.maxElementsOnDisk=0
2016-08-23 15:56:46,543 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - serviceTicketsCache.isOverflowToDisk=true
2016-08-23 15:56:46,543 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - serviceTicketsCache.timeToLive=12
2016-08-23 15:56:46,543 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - serviceTicketsCache.timeToIdle=0
2016-08-23 15:56:46,543 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - serviceTicketsCache.cacheManager=
ticketRegistryCacheManager
2016-08-23 15:56:46,543 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - ticketGrantingTicketsCache.maxElementsInMemory=
10000
2016-08-23 15:56:46,544 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - ticketGrantingTicketsCache.maxElementsOnDisk=
10000000
2016-08-23 15:56:46,544 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - ticketGrantingTicketsCache.isOverflowToDisk=false
2016-08-23 15:56:46,544 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - ticketGrantingTicketsCache.timeToLive=14400
2016-08-23 15:56:46,544 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - ticketGrantingTicketsCache.timeToIdle=14400
2016-08-23 15:56:46,544 DEBUG [org.jasig.cas.ticket.registry.
EhCacheTicketRegistry] - ticketGrantingTicketsCache.cacheManager=__DEFAULT__

Notice the last line.. __DEFAULT__ where it should be 
ticketRegistryCacheManager I believe this to be the cause of the 
non-replicating TGTs.

ticketRegistry.xml:
<?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"
        p:configLocation=
"${ehcache.config.file:classpath:ehcache-replicated.xml}"
        p:shared="${ehcache.cachemanager.shared:false}"
        p:cacheManagerName=
"${ehcache.cachemanager.name:ticketRegistryCacheManager}" />

    <bean id="ticketRegistry" class=
"org.jasig.cas.ticket.registry.EhCacheTicketRegistry"
      p:serviceTicketsCache-ref="serviceTicketsCache" 
p:ticketGrantingTicketsCache-ref="ticketGrantingTicketsCache" />
   
    <bean id="abstractTicketCache" class=
"org.springframework.cache.ehcache.EhCacheFactoryBean"
          abstract="true">
        <property name="cacheManager" ref="cacheManager" />
        <property name="diskExpiryThreadIntervalSeconds" value=
"${ehcache.disk.expiry.interval.seconds:0}" />
        <property name="diskPersistent" value=
"${ehcache.disk.persistent:false}" />
        <property name="eternal" value="${ehcache.eternal:false}" />
        <property name="maxElementsInMemory" value=
"${ehcache.max.elements.memory:10000}" />
        <property name="maxElementsOnDisk" value=
"${ehcache.max.elements.disk:0}" />
        <property name="memoryStoreEvictionPolicy" value=
"${ehcache.eviction.policy:LRU}" />
        <property name="overflowToDisk" value=
"${ehcache.overflow.disk:false}" />
        <property name="bootstrapCacheLoader">
            <ref bean="ticketCacheBootstrapCacheLoader" />
        </property>
    </bean>

    <bean id="serviceTicketsCache" class=
"org.springframework.cache.ehcache.EhCacheFactoryBean"
          parent="abstractTicketCache">
        <property name="cacheName" value=
"${ehcache.cache.st.name:org.jasig.cas.ticket.ServiceTicket}" />
        <property name="cacheEventListeners">
            <ref bean="ticketRMISynchronousCacheReplicator" />
        </property>

        <!-- The maximum number of seconds an element can exist in the 
cache without being accessed. The
          element expires at this limit and will no longer be returned from 
the cache. The default value is 0,
          which means no TTI eviction takes place (infinite lifetime). -->
        <property name="timeToIdle" value="${ehcache.cache.st.timeIdle:0}" 
/>

        <!-- The maximum number of seconds an element can exist in the 
cache regardless of use. The element
          expires at this limit and will no longer be returned from the 
cache. The default value is 0, which means
          no TTL eviction takes place (infinite lifetime). -->
        <property name="timeToLive" value=
"${ehcache.cache.st.timeAlive:300}" />
    </bean>

    <bean id="ticketGrantingTicketsCache" class=
"org.springframework.cache.ehcache.EhCacheFactoryBean"
          parent="abstractTicketCache" p:cacheManager-ref="cacheManager">
        <property name="cacheName" value=
"${ehcache.cache.tgt.name:org.jasig.cas.ticket.TicketGrantingTicket}" />
        <property name="cacheEventListeners">
            <ref bean="ticketRMIAsynchronousCacheReplicator" />
        </property>

        <!-- The maximum number of seconds an element can exist in the 
cache regardless of use. The element
          expires at this limit and will no longer be returned from the 
cache. The default value is 0, which means
          no TTL eviction takes place (infinite lifetime). For this sample 
configuration, 2 hours of inactivity
          before ticket granting tickets are expired automatically -->

        <property name="timeToIdle" value=
"${ehcache.cache.tgt.timeIdle:7201}" />

        <!-- The maximum number of seconds an element can exist in the 
cache without being accessed. The
          element expires at this limit and will no longer be returned from 
the cache. The default value is 0,
          which means no TTI eviction takes place (infinite lifetime). -->
        <property name="timeToLive" value="${ehcache.cache.tgt.timeAlive:0}" 
/>
    </bean>

    <bean id="ticketRMISynchronousCacheReplicator" class=
"net.sf.ehcache.distribution.RMISynchronousCacheReplicator">
        <constructor-arg name="replicatePuts" value=
"${ehcache.repl.sync.puts:true}" />
        <constructor-arg name="replicatePutsViaCopy" value=
"${ehcache.repl.sync.putscopy:true}" />
        <constructor-arg name="replicateUpdates" value=
"${ehcache.repl.sync.updates:true}" />
        <constructor-arg name="replicateUpdatesViaCopy" value=
"${ehcache.repl.sync.updatesCopy:true}" />
        <constructor-arg name="replicateRemovals" value=
"${ehcache.repl.sync.removals:true}" />
    </bean>

    <bean id="ticketRMIAsynchronousCacheReplicator" class=
"net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator"
          parent="ticketRMISynchronousCacheReplicator">
        <constructor-arg name="replicationInterval" value=
"${ehcache.repl.async.interval:10000}" />
        <constructor-arg name="maximumBatchSize" value=
"${ehcache.repl.async.batch.size:100}" />
    </bean>

    <bean id="ticketCacheBootstrapCacheLoader" class=
"net.sf.ehcache.distribution.RMIBootstrapCacheLoader">
        <constructor-arg name="asynchronous" value=
"${ehcache.cache.loader.async:true}" />
        <constructor-arg name="maximumChunkSize" value=
"${ehcache.cache.loader.chunksize:5000000}" />
    </bean>

</beans>

ehcache also complains about not finding a configuration for the TGT cache 
and says it is configuring ehcache from ehcache-failsafe.xml... I suspect 
this is a side effect of that bean not inheriting from the abstract 
parent's cacheManager bean.

I have also tried setting p:cacheManager-ref="cacheManager" on the 
ticketGrantingTicketsCache bean, but this doesn't change the behavior or 
log lines.

Any help or suggestions appreciated.  Thanks very much.

-- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/fe402d22-77cc-47dc-90e0-c36bb8d1befc%40apereo.org.
For more options, visit https://groups.google.com/a/apereo.org/d/optout.

Reply via email to