ClassCastException when application jar is deployed
mfrost Jun 10, 2004 9:29 AMHi
I am able to use the TreeCache in my JBoss cluster - and it works fine until I redeploy any of my application jars.
At this point I get a ClassCastException .
Why is the TreeCache stopped and started when any jar is redeployed - even if it has nothing to do with TreeCache??
If I subsequently try to use the cache from a SLSB I get the following
java.lang.NoSuchMethodException: org.jboss.cache.TreeCache._put(org.jboss.cache.GlobalTransaction, org.jboss.cache.Fqn, java.lang.Object, java.lang.Object, boolean)
I must restart all my cluster nodes.
I am using JBoss 3.2.3
I include the following
1. The ClassCastException stacktrace
2. My TreeCache XML descriptor (replSync-service.xml). Notice I have not specified a cluster config.
3. My SLSB code snippet
Anyone else experienced this?
Many thanks in advance
mark
14:00:25,316 INFO [TreeCache] setState(): setting the new state 14:00:25,332 ERROR [TreeCache] setState(): could not set cache: java.lang.ClassCastException at org.jboss.cache.TreeCache$MessageListenerAdaptor.setState(TreeCache.java:2469) at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.passUp(MessageDispatcher.java:470) at org.jgroups.blocks.RequestCorrelator.receive(RequestCorrelator.java:292) at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:515) at org.jgroups.JChannel.up(JChannel.java:860) at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:314) at org.jgroups.stack.ProtocolStack.receiveUpEvent(ProtocolStack.java:330) at org.jgroups.stack.Protocol.passUp(Protocol.java:470) at org.jgroups.protocols.pbcast.STATE_TRANSFER.handleStateRsp(STATE_TRANSFER.java:299) at org.jgroups.protocols.pbcast.STATE_TRANSFER.up(STATE_TRANSFER.java:119) at org.jgroups.stack.UpHandler.run(Protocol.java:55) 14:00:25,332 INFO [TreeCache] state was retrieved successfully (in 31 milliseconds
<?xml version="1.0" encoding="UTF-8"?> <!-- ===================================================================== --> <!-- --> <!-- Sample TreeCache Service Configuration --> <!-- --> <!-- ===================================================================== --> <server> <!--<classpath codebase="file:/C:/jboss/jboss-cache/lib" archives="jboss-cache.jar, jgroups.jar"/>--> <classpath codebase="file:/C:/jboss/jboss-cache/lib" archives="jboss-cache.jar"/> <!-- ==================================================================== --> <!-- Defines TreeCache configuration --> <!-- ==================================================================== --> <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=TreeCache"> <depends>jboss:service=Naming</depends> <depends>jboss:service=TransactionManager</depends> <!-- Configure the TransactionManager --> <!-- <attribute name="TransactionManagerLookupClass">org.jboss.cache.DummyTransactionManagerLookup</attribute> --> <!-- Isolation level : SERIALIZABLE REPEATABLE_READ (default) READ_COMMITTED READ_UNCOMMITTED NONE --> <attribute name="IsolationLevel">REPEATABLE_READ</attribute> <!-- Valid modes are LOCAL, REPL_ASYNC and REPL_SYNC --> <attribute name="CacheMode">REPL_SYNC</attribute> <!-- Just used for async repl: use a replication queue --> <attribute name="UseReplQueue">false</attribute> <!-- Replication interval for replication queue (in ms) --> <attribute name="ReplQueueInterval">0</attribute> <!-- Max number of elements which trigger replication --> <attribute name="ReplQueueMaxElements">0</attribute> <!-- Name of cluster. Needs to be the same for all clusters, in order to find each other --> <attribute name="ClusterName">TreeCache-Cluster</attribute> <!-- JGroups protocol stack properties. Can also be a URL, e.g. file:/home/bela/default.xml <attribute name="ClusterProperties"></attribute> --> <!-- Max number of entries in the cache. If this is exceeded, the eviction policy will kick some entries out in order to make more room --> <attribute name="MaxCapacity">20000</attribute> <!-- Whether or not to fetch state on joining a cluster --> <attribute name="FetchStateOnStartup">true</attribute> <!-- The max amount of time (in milliseconds) we wait until the initial state (ie. the contents of the cache) are retrieved from existing members in a clustered environment --> <attribute name="InitialStateRetrievalTimeout">5000</attribute> <!-- Number of milliseconds to wait until all responses for a synchronous call have been received. --> <attribute name="SyncReplTimeout">10000</attribute> <!-- Max number of milliseconds to wait for a lock acquisition --> <attribute name="LockAcquisitionTimeout">15000</attribute> <!-- Max number of milliseconds we hold a lock (not currently implemented) --> <attribute name="LockLeaseTimeout">60000</attribute> <!-- Name of the eviction policy class. Not supported now. --> <attribute name="EvictionPolicyClass"></attribute> </mbean> <!-- Uncomment to get a graphical view of the TreeCache MBean above --> <!-- <mbean code="org.jboss.cache.TreeCacheView" name="jboss.cache:service=TreeCacheView">--> <!-- <depends>jboss.cache:service=TreeCache</depends>--> <!-- <attribute name="CacheService">jboss.cache:service=TreeCache</attribute>--> <!-- </mbean>--> </server>
// find the first instance of an mbean server in the system (there will only be one)... List list = MBeanServerFactory.findMBeanServer(null); MBeanServer server = (MBeanServer)list.iterator().next(); ObjectName cacheService = new ObjectName("jboss.cache:service=TreeCache");; Object[] args; String[] sig; if (doPut) { //put into cache args = new Object[] {FQN, key, value}; sig = new String[] {String.class.getName(), Object.class.getName(), Object.class.getName()}; server.invoke(cacheService, "put", args, sig); System.out.println("...put into cache"); } //get from cache args = new Object[]{FQN, key}; sig = new String[]{String.class.getName(), Object.class.getName()}; value = server.invoke(cacheService, "get", args, sig); System.out.println("from cache value = " + value.toString());