Excellent. I want to call a method of a singleton service. I tried using an RMIAdaptor
this way:
| public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
| PrintWriter out = response.getWriter();
| String numero = request.getParameter("numero");
| String mensaje = request.getParameter("mensaje");
| try {
| Context context = new InitialContext();
| RMIAdaptor rmiAdaptor = (RMIAdaptor)context.lookup("jmx/rmi/RMIAdaptor");
| if ((rmiAdaptor != null) && (rmiAdaptor.isRegistered(new
ObjectName("poksmedia.mbean:service=MBloxService")))) {
| rmiAdaptor.invoke(new ObjectName("poksmedia.mbean:service=MBloxService"),
"sendMessage", new Object[]{numero, mensaje}, new
String[]{"java.lang.String", "java.lang.String"});
| out.print("El mensaje se envió correctamente (creo).");
| }
| } catch (NamingException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| } catch (MalformedObjectNameException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| } catch (NullPointerException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| } catch (InstanceNotFoundException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| } catch (MBeanException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| } catch (ReflectionException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| }
|
This works awesome in the same node where the service is running. But not in the others.
It throws a javax.management.RuntimeMBeanException
.
Any ideas?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134945#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...