Remoting via mbean issue
ucfjeff Feb 14, 2007 2:26 PMWe are attempting to deploy a Jboss Remoting Server as an mbean using JBossRemoting-2_0_0_GA on Jboss-4.0.4 jdk1.5.
We have used the following classes provided in the tests package as is:
org.jboss.test.remoting.handler.mbean.service.ClientTest:
public class ClientTest { private static String transport = "socket"; private static String host = "localhost"; private static int port = 5400; public void makeInvocation(String locatorURI) throws Throwable { InvokerLocator locator = new InvokerLocator(locatorURI); System.out.println("Calling remoting server with locator uri of: " + locatorURI); Client remotingClient = new Client(locator); remotingClient.connect(); Object response = remotingClient.invoke("Do something"); System.out.println("Invocation response: " + response); } public static void main(String[] args) { if(args != null && args.length == 2) { transport = args[0]; port = Integer.parseInt(args[1]); } String locatorURI = transport + "://" + host + ":" + port; ClientTest clientTest = new ClientTest(); try { clientTest.makeInvocation(locatorURI); } catch(Throwable e) { e.printStackTrace(); } } }
org.jboss.test.remoting.handler.mbean.MBeanHandler:
public class MBeanHandler implements MBeanHandlerMBean { private MBeanServer server = null; private ServerInvoker invoker = null; public void setMBeanServer(MBeanServer server) { this.server = server; } public void setInvoker(ServerInvoker invoker) { this.invoker = invoker; } public Object invoke(InvocationRequest invocation) throws Throwable { System.out.println(invocation.getParameter()); return ServerTest.RESPONSE_VALUE; } public void addListener(InvokerCallbackHandler callbackHandler) { } public void removeListener(InvokerCallbackHandler callbackHandler) { } void create() throws Exception { } void start() throws Exception { } void stop() { } void destroy() { } }
mbeanhandler-service.xml:
<server> <classpath codebase="lib" archives="*"/> <mbean code="org.jboss.remoting.network.NetworkRegistry" name="jboss.remoting:service=NetworkRegistry"/> <mbean code="org.jboss.remoting.samples.simple.MBeanHandler" name="test:type=handler"/> <mbean code="org.jboss.remoting.transport.Connector" xmbean-dd="org/jboss/remoting/transport/Connector.xml" name="jboss.remoting:service=Connector,transport=Socket" display-name="Socket transport Connector"> <attribute name="Configuration"> <config> <invoker transport="socket"> <attribute name="numAcceptThreads">1</attribute> <attribute name="maxPoolSize">303</attribute> <attribute name="clientMaxPoolSize" isParam="true">304</attribute> <attribute name="socketTimeout">60000</attribute> <attribute name="serverBindAddress">${jboss.bind.address}</attribute> <attribute name="serverBindPort">5400</attribute> <attribute name="enableTcpNoDelay" isParam="true">false</attribute> <attribute name="backlog">200</attribute> </invoker> <handlers> <handler subsystem="test">test:type=handler</handler> </handlers> </config> </attribute> </mbean> </server>
The mbean deploys as expected, however when we run the client we receive the following:
Client Side:
[java] Calling remoting server with locator uri of: socket://localhost:5400 [java] Invoking server with request of 'Do something' [java] 10:53:50,634 [ERROR] org.jboss.remoting.transport.socket.SocketClientInvoker: Got marshalling exception, exiting [java] java.net.SocketException [java] at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:348) [java] at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:116) [java] at org.jboss.remoting.Client.invoke(Client.java:612) [java] at org.jboss.remoting.Client.invoke(Client.java:604) [java] at org.jboss.remoting.Client.invoke(Client.java:589) [java] at org.jboss.remoting.samples.simple.SimpleClient.makeInvocation(Unknown Source) [java] at org.jboss.remoting.samples.simple.SimpleClient.main(Unknown Source) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [java] at java.lang.reflect.Method.invoke(Method.java:585) [java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:202) [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:134) [java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:710) [java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:178) [java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:84) [java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) [java] at org.apache.tools.ant.Task.perform(Task.java:364) [java] at org.apache.tools.ant.Target.execute(Target.java:341) [java] at org.apache.tools.ant.Target.performTasks(Target.java:369) [java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) [java] at org.apache.tools.ant.Project.executeTarget(Project.java:1185) [java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40) [java] at org.apache.tools.ant.Project.executeTargets(Project.java:1068) [java] at org.apache.tools.ant.Main.runBuild(Main.java:668) [java] at org.apache.tools.ant.Main.startAnt(Main.java:187) [java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) [java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) [java] java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is: [java] java.net.SocketException [java] at org.jboss.remoting.transport.socket.SocketClientInvoker.handleException(SocketClientInvoker.java:118) [java] at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:400) [java] at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:116) [java] at org.jboss.remoting.Client.invoke(Client.java:612) [java] at org.jboss.remoting.Client.invoke(Client.java:604) [java] at org.jboss.remoting.Client.invoke(Client.java:589) [java] at org.jboss.remoting.samples.simple.SimpleClient.makeInvocation(Unknown Source) [java] at org.jboss.remoting.samples.simple.SimpleClient.main(Unknown Source)
Server Side:
10:53:50,618 DEBUG [ServerThread] beginning dorun 10:53:50,618 ERROR [ServerThread] failed to process invocation. java.io.OptionalDataException at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1310) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339) at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128) at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:350) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:398) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239) 10:53:50,618 DEBUG [ServerThread] begin thread wait 10:53:50,618 DEBUG [ServerThread] WAKEUP in SERVER THREAD
Is there anything we are overlooking? Any assistance is greatly appreciated.