Remoting with EJB3
dhartford Feb 10, 2006 10:29 AMHey all,
Using what appears to be the old JNDI port 1099 way, I can do remote ejb3 tasks. That's cool, but the transport is adding a lot of time to the call.
So, jboss remoting seems to be a good idea. However, I can't seem to understand HOW to use jboss remoting.
I'm keeping the standard ejb3 connector configuration in jboss-service.xml (socket://0.0.0.0:3873) and using the following client code:
String locatorURI = "socket://myserver:3873"; //?serializationtype=jboss"; MyBusinessManager bam; try { bam = (MyBusinessManager)TransporterClient.createTransporterClient(locatorURI, MyBusinessManager.class); System.out.println(bam.hello()); TransporterClient.destroyTransporterClient(bam); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }
MyBusinessManager is an interface with the 'hello' method, and a MyBusinessManagerBean is in place that implements the interface (that simply returns a string for 'hello'). I get the following error when trying to run this client code:
java.lang.ClassCastException: org.jboss.remoting.invocation.NameBasedInvocation at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:81) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:660) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:513) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:290) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:344) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:202) at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:183) at org.jboss.remoting.Client.invoke(Client.java:444) at org.jboss.remoting.Client.invoke(Client.java:407) at org.jboss.remoting.Client.invoke(Client.java:392) at org.jboss.remoting.transporter.TransporterClient.invoke(TransporterClient.java:237) at $Proxy1.hello(Unknown Source) at ClientTest.main(ClientTest.java:60)
I've managed to go through most of the learning curve on my own, but this has me at a standstill :-(
-D