Greeting,
I want to implement a simple client-server application with the following feature: client receives some remote object and call it's method. I don't have an intention to use EJBs so my question if this possible with pure Spring Remoting features like Hessian.
The remote object that is being passed is
The client side has only IUser in its classpath, not UserImpl. So when I call Hessian Service, I receive en error like thisCode:import interfaces.IUser; public class UserImpl implements IUser { public String getAge() { return " 27 y.o "; } public String getName() { return " John Doe "; } public String getSex() { return " M "; } public String getUserString() { return getName() + getAge() + getSex(); } }
Code:java.lang.InstantiationException: interfaces.IUser at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at com.caucho.hessian.io.JavaDeserializer.instantiate(JavaDeserializer.java:172) at com.caucho.hessian.io.JavaDeserializer.readMap(JavaDeserializer.java:112) at com.caucho.hessian.io.HessianInput.readObject(HessianInput.java:662) at com.caucho.hessian.io.HessianInput.readReply(HessianInput.java:241) at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:179) at $Proxy0.getUser(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.remoting.caucho.HessianClientInterceptor.invoke(HessianClientInterceptor.java:163) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210) at $Proxy1.getUser(Unknown Source) at client.Client.callService(Client.java:39) at client.Client.main(Client.java:56)
I haven't looked at Hessian source code, but I could presume that it tries to instantiate UserImpl on the client side, where such class is absent in the classpath.
Can I configure Hessian somehow to send UserImpl class information with serialized UserImpl object?
Thanks in advance!


Reply With Quote