Hi Ben,
Reference - JBossCache 1.2.4 beta with Oracle 10g Application Server in a clustered environment (2 instances managed by a loadbalancer)
I have done the following -
I configure TreeCache as follows -
1. set "UseMarshalling" to true in the XML configuration file.
2. configure TreeCache as follows -
/*
* static block to instantiate the TreeCache with required properties
*/
static {
if (treeCache == null){
try {
treeCache = new TreeCache();
PropertyConfigurator config = new PropertyConfigurator();
config.configure(treeCache, "objectcache.xml");
treeCache.createService();
treeCache.startService();
ClassLoader ccl = Thread.currentThread().getContextClassLoader();
treeCache.registerClassLoader("/incivinci", ccl);
} catch(Exception e){
e.printStackTrace();
}
}
}
Observation -
1. When both the instances behind the loadbalancer are up and running. The object is marshalled and unmarshalled across the instances without the ClassNotFoundException.
2. Now I down one of the instance to check the replication. This too works fine without the ClassNotFoundException.
3. Now I bring the down instance up and the when the TreeCache tries to sync with the other instance I get the ClassNotFoundException as follows -
05/09/26 14:24:14 Configuring the TreeCache - org.jboss.cache.TreeCache [0 nodes, 0 locks
]
Sep 26, 2005 2:24:14 PM org.jboss.cache.PropertyConfigurator
INFO: Found existing property editor for org.w3c.dom.Element: org.jboss.util.propertyedit
or.ElementEditor@124111a
Sep 26, 2005 2:24:14 PM org.jboss.cache.PropertyConfigurator configure
INFO: configure(): attribute size: 16
Sep 26, 2005 2:24:14 PM org.jboss.cache.TreeCache setClusterConfig
INFO: setting cluster properties from xml to: UDP(mcast_addr=228.1.2.3;mcast_port=45566;i
p_ttl=8;ip_mcast=true;mcast_send_buf_size=800000;mcast_recv_buf_size=150000;ucast_send_bu
f_size=800000;ucast_recv_buf_size=150000;loopback=true):PING(timeout=2000;num_initial_mem
bers=3;up_thread=true;down_thread=true):MERGE2(min_interval=10000;max_interval=20000):FD(
shun=true;up_thread=true;down_thread=true;timeout=2500;max_tries=5):VERIFY_SUSPECT(timeou
t=3000;num_msgs=3;up_thread=true;down_thread=true):pbcast.NAKACK(gc_lag=50;retransmit_tim
eout=300,600,1200,2400,4800;max_xmit_size=8192;up_thread=true;down_thread=true):UNICAST(t
imeout=300,600,1200,2400,4800;window_size=100;min_threshold=10;down_thread=true):pbcast.S
TABLE(desired_avg_gossip=20000;up_thread=true;down_thread=true):FRAG(frag_size=8192;down_
thread=true;up_thread=true):pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=tru
e;print_local_addr=true):pbcast.STATE_TRANSFER(up_thread=true;down_thread=true)
Sep 26, 2005 2:24:14 PM org.jboss.cache.TreeCache _createService
WARNING: No transaction manager lookup class has been defined. Transactions cannot be used
Sep 26, 2005 2:24:14 PM org.jboss.cache.TreeCache createPessimisticInterceptorChain
INFO: interceptor chain is:
class org.jboss.cache.interceptors.CallInterceptor
class org.jboss.cache.interceptors.PessimisticLockInterceptor
class org.jboss.cache.interceptors.UnlockInterceptor
class org.jboss.cache.interceptors.ReplicationInterceptor
Sep 26, 2005 2:24:14 PM org.jboss.cache.TreeCache _createService
INFO: cache mode is REPL_ASYNC
Sep 26, 2005 2:24:15 PM org.jboss.cache.TreeCache _createService
INFO: USE_MARSHALLING is true. We will marshall/unmarshall the value.
Sep 26, 2005 2:24:15 PM org.jgroups.protocols.UDP createSockets
INFO: sockets will use interface 192.5.2.87
Sep 26, 2005 2:24:15 PM org.jgroups.protocols.UDP createSockets
INFO: socket information:
local_addr=192.5.2.87:1438, mcast_addr=228.1.2.3:45566, bind_addr=/192.5.2.87, ttl=8
sock: bound to 192.5.2.87:1438, receive buffer size=150000, send buffer size=800000
mcast_recv_sock: bound to 192.5.2.87:45566, send buffer size=800000, receive buffer size=
150000
mcast_send_sock: bound to 192.5.2.87:1439, send buffer size=800000, receive buffer size=1
50000
05/09/26 14:24:15
-------------------------------------------------------
GMS: address is 192.5.2.87:1438
-------------------------------------------------------
Sep 26, 2005 2:24:17 PM org.jboss.cache.TreeCache startService
INFO: my local address is 192.5.2.87:1438
Sep 26, 2005 2:24:17 PM org.jboss.cache.TreeCache viewAccepted
INFO: viewAccepted(): [192.5.2.87:1426|3] [192.5.2.87:1426, 192.5.2.87:1438]
Sep 26, 2005 2:24:17 PM org.jboss.cache.TreeCache _setState
INFO: received the state (size=704 bytes)
Sep 26, 2005 2:24:17 PM org.jboss.cache.TreeCache _setState
INFO: transient state: 652 bytes
Sep 26, 2005 2:24:17 PM org.jboss.cache.TreeCache _setState
INFO: setting transient state for /
Sep 26, 2005 2:24:17 PM org.jboss.cache.TreeCache _setState
SEVERE: failed setting transient state
java.lang.ClassNotFoundException: com.incivinci.beantocache.UserInfoBean
at com.evermind.naming.ContextClassLoader.findClass(ContextClassLoader.java:314)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at com.evermind.naming.ContextClassLoader.loadClass(ContextClassLoader.java:139)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:217)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:558)
at org.jboss.invocation.MarshalledValueInputStream.resolveClass(MarshalledValueIn
putStream.java:95)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at java.util.HashMap.readObject(HashMap.java:986)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.j
ava:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:824)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at org.jboss.cache.TreeNode.readExternal(TreeNode.java:543)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1686)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1644)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.readObject(Concurrent
ReaderHashMap.java:1391)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.j
ava:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:824)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
Have I missed out something.