Good day.
I deployed the EJB3 trailblazer (JBoss 4.04 RC1) including the calculator MBean
and managed to write a client that activates the calculator.
Now, I decided to take one step futher. In my tester class i wrote a static
class called MyTask that implements Runnable and Serializable and looks like
this:
public static class MyTask implements Runnable, Serializable {
private static final long serialVersionUID = -1575628286339248259L;
public void run()
{
System.out.println("hello!");
}
}
I then wrote the following code to get a thread pool (I found there are two
thread pools by browsing with JBoss JMX-Console)
Object o = ctx.lookup("jmx/invoker/RMIAdaptor");
MBeanServerConnection mbsc = (MBeanServerConnection)o;
ObjectName objName = new ObjectName("jboss.system:service=ThreadPool");
if (mbsc.isRegistered(objName))
{
ObjectInstance objInstance = mbsc.getObjectInstance(objName);
if (objInstance != null)
{
System.out.println("got object instance");
System.out.println(objInstance.getClassName());
System.out.println(objInstance.getObjectName());
o = MBeanServerInvocationHandler.newProxyInstance(mbsc,
objName,ThreadPool.class,false);
if (o != null)
{
System.out.println("created proxy!");
ThreadPool threadPool = (ThreadPool)o;
threadPool.run(new MyTask());
}
}
}
I get the following exception:
java.lang.IllegalStateException: getArguments failed
at
org.jboss.invocation.MarshalledInvocation.getArguments(MarshalledInvocation.java:513)
at
org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:235)
at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
.....
My question is - what am I doing wrong here? How can I use the thread pool to
execute one task from the client side? is this because the client is not
running on the same VM ?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3947685#3947685
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3947685
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user