You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Martin Zardecki <mp...@truecool.com> on 2006/09/06 07:05:25 UTC

Remote setup issues

Hi List, sorry for the long winded message but I'm trying to describe 
the problem as completely as I can.

I'm trying to use JCS in a Remote Server/Client configuration to resolve 
a distributed application issue. I only want to use memory and/or server 
caching; not interested in disk caching. Not currently interested in any 
fail over features either.

I've downloaded the latest version along with concurrent jar and 
commons-logging.jar.

My /cache.ccf file is as follows:

# JCS Remote Server config
# lolo is my development machine where I'm trying JCS out before we 
deploy to a test or prod server
registry.host=lolo.truecool.com
registry.port=1102
remote.cache.service.port=1102
remote.cluster.LocalClusterConsistency=true
remote.cluster.AllowClusterGet=true

# DEFAULT CACHE REGION
jcs.default=RC
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=3000
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache

# The remote JCS client
jcs.auxiliary.RC=org.apache.jcs.auxiliary.remote.RemoteCacheFactory
jcs.auxiliary.RC.attributes=org.apache.jcs.auxiliary.remote.RemoteCacheAttributes
jcs.auxiliary.RC.attributes.RemoteHost=lolo.truecool.com
jcs.auxiliary.RC.attributes.RemotePort=1102
jcs.auxiliary.RC.attributes.LocalPort=1201
jcs.auxiliary.RC.attributes.RemoveUponRemotePut=false
jcs.auxiliary.RC.attributes.RmiSocketFactoryTimeoutMillis=5000
jcs.auxiliary.RC.attributes.GetOnly=false
jcs.auxiliary.RC.attributes.Receive=true

I'm running in an J2EE environment using OC4J 9.0.4.0 where I start the 
server with a security policy as follows:
 ...-Djava.security.manager -Djava.security.policy=./config/server.policy..

Where my server.policy is:

grant {
  permission java.security.AllPermission;
};

I'm starting the JCS Server from my web.xml  as follows:

  <servlet>
    <servlet-name>JCSRemoteCacheStartupServlet</servlet-name>
    
<servlet-class>org.apache.jcs.auxiliary.remote.server.RemoteCacheStartupServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>JCSRemoteCacheStartupServlet</servlet-name>
    <url-pattern>/jcs</url-pattern>
  </servlet-mapping>

The server appears to bind correctly since the log has this message:

Sep 5, 2006 10:44:28 PM 
org.apache.jcs.auxiliary.remote.server.RemoteCacheServerFactory startup
INFO: Binding server to 192.168.1.102:1102 with the name 
org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService

I have a CachingFinder class where I prepare a JCS instance variable 
like this:

  protected CachingFinder() {
    try {
      CompositeCacheAttributes cacheAttributes = new 
CompositeCacheAttributes();
      String cacheName = 
StringUtils.getLastPortion(getClass().getName(), ".");
      cacheAttributes.setCacheName(cacheName);
      cacheAttributes.setMaxObjects(getMaxSize());
      cacheAttributes.setUseLateral(false);
      cacheAttributes.setUseDisk(false);
      cacheAttributes.setUseMemoryShrinker(false);
      cacheAttributes.setUseRemote(true);
      setCache(JCS.getInstance(cacheName, cacheAttributes));
    } catch (Exception e) {
      setCache(null);
    }
  }
...

Unfortunately whenever I try instantiating my CachingFinder(s) either to 
pre-load the cache or to fetch values I have all kinds of bind 
exceptions which I believe cause problems further on (nothing else 
appears to work i.e. fetching remote values or setting remote values).

Whenever I try initializing a CachingFinder I get:

Sep 5, 2006 10:44:28 PM 
org.apache.jcs.engine.control.CompositeCacheConfigurator 
parseElementAttributes
INFO: No special ElementAttribute class defined for key 
[jcs.region.SystemScriptFinder.elementattributes], using default class.
Sep 5, 2006 10:44:28 PM org.apache.jcs.engine.memory.lru.LRUMemoryCache 
initialize
INFO: initialized LRUMemoryCache for SystemScriptFinder
Sep 5, 2006 10:44:28 PM org.apache.jcs.engine.control.CompositeCache <init>
INFO: Constructed cache with name [SystemScriptFinder] and cache 
attributes [ useLateral = false, useRemote = true, useDisk = false, 
maxObjs = 200, maxSpoolPerRun = -1, diskUsagePattern = 0 ]
Sep 5, 2006 10:44:29 PM 
org.apache.jcs.auxiliary.remote.RemoteCacheManager addRemoteCacheListener
INFO: The remote cache is configured to receive events from the remote 
server.  We will register a listener.
Sep 5, 2006 10:44:39 PM 
org.apache.jcs.auxiliary.remote.RemoteCacheManager getCache
SEVERE: Error unmarshaling return header; nested exception is:
    java.net.SocketTimeoutException: Read timed out

Whenever I try accessing a remote cache I get:

SEVERE: Disabling remote cache due to error Failed to get [14] from 
[SystemUserFinder]
Sep 5, 2006 10:45:20 PM org.apache.jcs.auxiliary.remote.RemoteCache 
handleException
SEVERE: java.rmi.UnmarshalException: Error unmarshaling return header; 
nested exception is:
    java.net.SocketTimeoutException: Read timed out

I've tried a variety of configurations but haven't been able to progress 
further; any help would be appreciated.

Thanks,

Martin Zardecki
mpzarde@truecool.com




---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org