Jboss JMX and jini lookup service
jonesgeek Apr 6, 2006 10:03 AMBACKGROUND:
I have a handfull of services (MyService) that all do the same thing, but can only handle one request at a time.
I need to have them managable through JMX.
I need to make it easy for a client to discover an available MyService and use it.
We currently use JBoss as our application server.
IMPLIMENTATION:
I have the MyServices register themselves with a jini lookup service (reggie) using jeri (Jini Extensable Remote Invocation).
The MyServices (and their remote proxy) impliment an MBean interface (MyServiceMBean) so they can be registered with an MBean server.
I have an MBeanService (MyServiceMonitor) register itself as a ServiceDiscoveryListener with the jini lookup service.
When MyServiceMonitor is notified that a MyService has been registered with the jini lookup service, it gets a remote proxy object (which impliments ProxyMBean) and registers that object with the MBean server.
So at this point, the MyService is registered with the jini lookup service and also with the MBean server. The client can find a service and use it, and the services can be managed by connecting to the JMX Agent via a HTTP connector, or whatever the Agent supports.
PROBLEM:
This works fine with an Agent using java's JMX reference implimentation, but now I am trying integrate with JBoss. I am trying to bring in the JMX stuff first. I built a SAR for the MyServiceMonitor, that is working great. It registers the MyService proxys when notified. I can still access the service with a client (the jini side works) but when going to the jmx-console, I can see the MyService MBeans that are registered, and when I go to manage one, I can see all the attribute names and methods, but the vales for the attributes are "javax.management.ReflectionException", and when I try to invoke a method, I get the following exception:
09:48:58,578 ERROR [[HtmlAdaptor]] Servlet.service() for servlet HtmlAdaptor threw exception
javax.management.ReflectionException
at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:171)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:149)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:243)
at org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:208)
at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:247)
at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:85)
at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...
One more note, before registering the MyService proxy object with the MBean server (in the MyServiceMonitor), the proxy works properly.
SUGGESTIONS???
I've put alot of effort into this project, and really would like to continue on the path chosen, but I am not die-hard on it. If there is a better, easier way, I am open to suggestions. I would really appreciate if anyone has insight on why this worked in java's reference implimentation of JMX, and not JBoss's.
This is the first time I've written anything using JMX or jini. From what I've read, jini is aging fast. Most posts or articles that I've come accross was a couple years old, not much recent stuff.
Thanks for drudging through this with me,
-Will