0

This error occurs when I'm trying to invoke a method available for me through spring's remote service.
The error is as follows:

org.springframework.remoting.RemoteAccessException: Cannot deserialize result from HTTP invoker remote service [remote service address]; 
nested exception is java.lang.ClassNotFoundException: default.CommonException
at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.convertHttpInvokerAccessException(HttpInvokerClientInterceptor.java:192)
at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:157)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy25.getQueryResult(Unknown Source)
at default.Main.main

What can be the problem caused by? Results from all other methods get deserialized without a problem.

EDIT: I try to get this result simply by:
Result res = remoteService.getResult(param);

gourmej
  • 3
  • 1
  • 6
  • `ClassNotFoundException: sds.eco.common.exception.CommonException`, guess that service throws that exception and `remoteService` cannot find this class, maybe some dependency is missing? (Knowing quite little about Spring). Exception then itself might be because wrong params or so – pirho Oct 12 '17 at 17:46
  • Thanks, but I am pretty sure that the parameter I pass to getResult is a valid one since it's an object that I receive using remote service. – gourmej Oct 13 '17 at 07:45
  • The CommonException is my exception, I fixed the error message so that it is more obvious. – gourmej Oct 13 '17 at 07:47
  • can you invoke this remote method directly (for example if it is REST by HTTP-request) and see what it actually returns ? – pirho Oct 13 '17 at 08:18
  • getResult is supposed to return Result object and the method that I use to get parameter object returns some let's say Parameter object. – gourmej Oct 13 '17 at 08:22
  • yes i can see that but the problem might be that the service returns something that cannot be built to a `Response` object. So it might help if you could log - with some interceptor for example - or make the low level http call - with browser for example -to the service and see the serialized from of response – pirho Oct 13 '17 at 08:28

1 Answers1

1

The remote service has thrown a default.CommonException, which is then serialized by spring remoting and then tried to deserialized: at this point you get the ClassNotFound.

I think you don't have default.CommonException on the classpath on the caller side, so deserializing does not work.

Marco Nembrini
  • 111
  • 1
  • 3