Announcement Announcement Module
No announcement yet.
ClassNotFoundException with Exceptions from Client to Server Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • ClassNotFoundException with Exceptions from Client to Server

    Hi all,

    we are using Spring Remoting in our project and have encountered the problem that when an Exception occurs on the server side during a service call and the thrown exception is not known on the client side (e.g. a Hibernate exception), we get a ClassNotFoundException for the exception class when propagating the server exception to the client.

    The ClassNotFoundException makes totally sense since the exception class is simply not known on the client side (and should not be known!). The question now is how I can prevent such exceptions from being propagated to the client. Since I think that virtually every client/server application has this problem, I guess there might be some standard solution?

    Right now, we have found a solution to the problem by implementing a custom MethodInterceptor which is added to the list of interceptors supported by the spring remoting class HttpInvokerServiceExporter (see HttpInvokerServiceExporter#setInterceptors()). Within the MethodInterceptor I'm wrapping exceptions which occur during the service call and I only propagate the stack trace information of the exception but not the exception object itself.

    While the custom solution seems to work, I was wondering whether there is a standard solution provided by spring remoting since I think this should be a very common problem.

    Thanks in advance for any help!