-
1. Re: UndeclaredThrowableException
lepekhine Aug 29, 2002 10:05 AM (in response to mohansaravanan)Hi, mohansaravanan!
I think, your EJB method you call in jsp throws exception that is not declared in interface.
Following is a qoute from java API srec:
"Thrown by a method invocation on a proxy instance if its invocation handler's invoke method throws a checked exception (a Throwable that is not assignable to RuntimeException or Error) that is not assignable to any of the exception types declared in the throws clause of the method that was invoked on the proxy instance and dispatched to the invocation handler.
An UndeclaredThrowableException instance contains the undeclared checked exception that was thrown by the invocation handler, and it can be retrieved with the getUndeclaredThrowable() method. UndeclaredThrowableException extends RuntimeException, so it is an unchecked exception that wraps a checked exception." -
2. Re: UndeclaredThrowableException
lepekhine Aug 29, 2002 10:27 AM (in response to mohansaravanan)This is a common case when EJB method throws exception
unexpected by client.
Please, see java API description for UndeclaredThrowableException.
May be it helps...
With JBoss I often get exceptions with null message.
Then I use somthing like:
catch (Exception e) {
String error_message = e.getMessage();
if (error_message == null) {
java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
e.printStackTrace(new java.io.PrintStream(out)); // new PrintWriter(out) doesn't work here!
error_message = out.toString();
}
e.printStackTrace();
request.setAttribute("javax.servlet.jsp.jspException", new Exception(error_message));
request.getRequestDispatcher(error_page).forward(request, response);
}
The idea is to throw Exception with a message that is
an error stack trace.
Regards, Alexander