I have the following code in a RS POJO:
try { x = this.get(MyClass).myMethod(); } catch (MyException me) { System.out.println(me.getMessage()); }
myMethod throws a MyException, but the catch never gets executed. Instead I get:
org.jboss.resteasy.spi.UnhandledException: Message from MyException ... Root CauseMessage from MyException com.myco.MyClass.myMethod(MyClass.java:2) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:252) org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:217) org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:206) org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:514) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:491) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:120) org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:200) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:48) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:43) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
Any ideas on how to get reasteasy to let the catch handle the error ?
Thanks,
Craig.
Please post this to the RESTEasy forum section.