wood burning stoves 2.0*
The moose likes Servlets and the fly likes Propogate CustomException from servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Propogate CustomException from servlet" Watch "Propogate CustomException from servlet" New topic

Propogate CustomException from servlet

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10172

I have an application where the Swing UI client communicates to a servlet using serialized object IO.
My problem is I want to propagate custom exceptions to the UI. I have created a super class extending Throwable and all my custom exceptions subclass it.
Whenever I wanted to throw an exception, it tried wrapping it inside the ServletException/IOException.

On the client side I never get the ServletException but only the IOException.
From the IOException the call to getCause returns null.
Surprisingly I can see my custom exception on the server side stack trace.

What am I doing wrong?

PS. As a workaround I started writing my custom exception to the output stream and the code is working now. But I am sure this is not the correct solution.
[ July 15, 2008: Message edited by: Maneesh Godbole ]

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Propogate CustomException from servlet
Similar Threads
exception Tag in web.xml
Can someone help me? I think my exceptions may be wrong but need opinion (B&S)
Througing HTTP 1.1 500 when my servlet was not syncronized
servlet/jsp exception handling question
JavaBeat question. error-page