Hi,
I am trying to get my web application to send a message to the other nodes
in the cluster. I am planning on using JMX to do this.
So far I have been able to query all the information I need but I am unable
to invoke the send command.
I have followed the instructions in an earlier post with the subject
"Cluster and notifications to nodes". In summary here they are again:
a) mark application as priviliged=true
b) define and implement your own ClusterMessage
c) via MbeansServer you got the
Catalina:type=Cluster,host=localhost
mbean and send your
operation ( send(ClusterMessage)).
d) Register a ClusterListener.
My version of step c looks like:
Registry registry = Registry.getRegistry(null, null);
MBeanServer server = registry.getMBeanServer();
ObjectName cluster = new
ObjectName("simple-cluster:type=Cluster,host=localhost");
server.invoke(cluster, "send", new Object[] {new
ClusterEventMessage()}, new String[] {"
org.apache.catalina.cluster.ClusterMessage"});
I am using Tomcat 5.5.12.
See below for the exception that I get:
2006-07-18 12:22:53,875 ERROR http-8090-Processor25
jmxtests.SendEventServlet - Cannot find method send with this signature
javax.management.ReflectionException: Cannot find method send with this
signature
at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java
:490)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(
DynamicMetaDataImpl.java:213)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java :220)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(
DefaultMBeanServerInterceptor.java:815)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java
:784)
at jmxtests.SendEventServlet.service (SendEventServlet.java:54)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java :173)
at org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke (
StandardHostValve.java:126)
at org.apache.catalina.cluster.tcp.ReplicationValve.invoke(
ReplicationValve.java:247)
at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke (
StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:868)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(
Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java :80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NoSuchMethodException:
org.apache.catalina.cluster.tcp.SimpleTcpCluster.send (
org.apache.catalina.cluster.ClusterMessage)
at java.lang.Class.getMethod(Class.java:1581)
at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java
:484)
... 20 more
Thanks,
Jon.