commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russell Sherk <>
Subject RE: JCS LateralTCPCacheFactory
Date Thu, 27 Jul 2017 14:52:19 GMT
Hi Greg,

Don't know much about JCS. Just general Tomcat stuff. 

See if this helps:

If not, maybe someone else in the list can help.



-----Original Message-----
From: Greg Parker [] 
Sent: July-27-17 10:07 AM
To: Commons Users List <>
Subject: Re: JCS LateralTCPCacheFactory

Thanks Russ,

So the TcpListenerPort value should match the tomcat port?  So if tomcat is running on port
6080 the cache.ccf on that instance should set TcpListenerPort=6080?  I set things up this
way and nothing seems to complain; however, now I get a SEVERE error on first access and caching
is not working across the three instances.  Here are the details:

SEVERE [ajp-nio-6009-exec-1] org.apache.commons.jcs.engine.control.CompositeCacheConfigurator.parseAuxiliary
Could not instantiate auxiliary cache named "hello".




> On Jul 27, 2017, at 8:57 AM, Russell Sherk <> wrote:
> Hi Greg,
> Tomcat uses two consecutive ports. The one you specify and the next one for shutdown.
E.g if you specify 8020, the shutdown port by default is 8021.
> Try spacing your ports out: 8020, 8022, 8024.
> --Russ
> On Jul 26, 2017 10:11 PM, Greg Parker <> wrote:
> I'm trying to get a sample cluster of tomcat servers (server A, B and C) to use a distributed
cache.  The ‘hello’ cache is configured on each server with a different TcpListenerPort
on each server (8020, 8021, 8022) like this:
> jcs.region.hello=LTCP
> …
> jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp
> .LateralTCPCacheFactory 
> jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral
> .socket.tcp.TCPLateralCacheAttributes
> jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
> jcs.auxiliary.LTCP.attributes.AllowGet=true
> jcs.auxiliary.LTCP.attributes.Receive=true
> jcs.auxiliary.LTCP.attributes.TcpListenerPort=8020
> jcs.auxiliary.LTCP.attributes.TcpServers=localhost:8020,localhost:8021
> ,localhost:8022
> Server A has a page that sets a value in the cache like this:
>        cache = JCS.getInstance("hello");
>        cache.put(“message", “Hello from server A");
> Server B, and C try to get the value without setting it:
>        cache = JCS.getInstance("hello");
>        add(new Label("message", "Server B -> cache has : " +  
> cache.get(“message");));
> The first time I access the page on server A I get an exception -  "Cannot connect to
localhost:8021”.  If I access the page on each server then things appear to start communicating;
however, the “message” entry from the “hello” region is set on server A and null on
B and C.  Sometimes I see the value on server C displayed properly but never on server B.
> With a configuration like this should I expect to see values immediately distributed
to the other servers?
> Is there a way I should be bootstrapping the cache when the server starts?  If the servers
need to communicate with one another it would seem to me that they need to be listening long
before the first time the server tries to access the cache.
> For performance I would like to use the cache to store serialized XML data instead of
storing it in the session or a database.  The data remains in the cache while the user transforms
it through several request cycles.  So during a request cycle the XML data would be retrieved,
transformed, and stored back in the cache.  In a clustered environment I need the XML data
available on every server in the cluster.  Is this an acceptable use case for JCS?
> Thanks

View raw message