I am trying to upload a file using Flex FileReference Object and a Java Servlet. I connect to the server fine and I can see the filename while debugging. It tries to upload a file but throws some exception. I catch this exception and then throw a RunTimeException to Flex. But in flex I have a try and catch block where it does not get caught. How do I catch this kind of exception thrown by a Servlet?