xp-framework/rfc — Issue #76: Transfer exception causes
Author: thekid
Created: 2011-10-17 15:51:58+00:00
State: closed
Labels: framework, implemented

Scope of Change
====
An exception's cause will be transferred via EASC to the client.

Rationale
====
The remote.InvocationException's stacktrace is not really helpful in
finding what may have caused a serverside exception.

Functionality
====

PHP side
----
The remote.ExceptionReference will extend util.ChainedException instead
of lang.Exception

Java side
----
Exception serialization will be changed to include a "cause" member
including the serialized representation of the exception's cause.
Note: This may be NULL.

Example #1
----
A complete stacktrace - without the patch, only the InvocationException's
stracktrace will be shown. One wouldn't be able to see that this originated
from a org.apache.lucene.queryParser.ParseException...

```
Exception remote.InvocationException ()
at php.sun.reflect.GeneratedMethodAccessor4::invoke() [line -1 of StackTraceElement.class.php]
at php.sun.reflect.DelegatingMethodAccessorImpl::invoke() [line 25 of DelegatingMethodAccessorImpl.java]
at php.java.lang.reflect.Method::invoke() [line 585 of Method.java]
at php.net.xp_framework.easc.server.CallDelegate::invoke() [line 25 of CallDelegate.java]
at php.net.xp_framework.easc.protocol.standard.ServerHandler::handle() [line 73 of ServerHandler.java]
at php.net.xp_framework.easc.server.HandlerThread::run() [line 50 of HandlerThread.java]
Caused by Exception remote.ExceptionReference ()
at php.$Proxy5::search() [line -1 of StackTraceElement.class.php]
at php.sun.reflect.GeneratedMethodAccessor4::invoke() [line -1 of StackTraceElement.class.php]
at php.sun.reflect.DelegatingMethodAccessorImpl::invoke() [line 25 of DelegatingMethodAccessorImpl.java]
at php.java.lang.reflect.Method::invoke() [line 585 of Method.java]
at php.net.xp_framework.easc.server.CallDelegate::invoke() [line 25 of CallDelegate.java]
at php.net.xp_framework.easc.protocol.standard.ServerHandler::handle() [line 73 of ServerHandler.java]
at php.net.xp_framework.easc.server.HandlerThread::run() [line 50 of HandlerThread.java]
Caused by Exception remote.InvocationException ()
at php.sun.reflect.GeneratedMethodAccessor5::invoke() [line -1 of StackTraceElement.class.php]
at php.sun.reflect.DelegatingMethodAccessorImpl::invoke() [line 25 of DelegatingMethodAccessorImpl.java]
at php.java.lang.reflect.Method::invoke() [line 585 of Method.java]
at php.de.schlund.easc.standalone.EASCInvocationHandler::invoke() [line 31 of EASCInvocationHandler.java]
at php.$Proxy5::search() [line -1 of StackTraceElement.class.php]
at php.sun.reflect.GeneratedMethodAccessor4::invoke() [line -1 of StackTraceElement.class.php]
at php.sun.reflect.DelegatingMethodAccessorImpl::invoke() [line 25 of DelegatingMethodAccessorImpl.java]
at php.java.lang.reflect.Method::invoke() [line 585 of Method.java]
at php.net.xp_framework.easc.server.CallDelegate::invoke() [line 25 of CallDelegate.java]
at php.net.xp_framework.easc.protocol.standard.ServerHandler::handle() [line 73 of ServerHandler.java]
at php.net.xp_framework.easc.server.HandlerThread::run() [line 50 of HandlerThread.java]
Caused by Exception remote.ExceptionReference (Lexical error at line 1, column 1. Encountered: "*" (42), after : "")
at php.org.apache.lucene.queryParser.QueryParser::parse() [line 125 of QueryParser.java]
at php.de.schlund.easc.standalone.LuceneSearchHandler::search() [line 67 of LuceneSearchHandler.java]
at php.sun.reflect.GeneratedMethodAccessor5::invoke() [line -1 of StackTraceElement.class.php]
at php.sun.reflect.DelegatingMethodAccessorImpl::invoke() [line 25 of DelegatingMethodAccessorImpl.java]
at php.java.lang.reflect.Method::invoke() [line 585 of Method.java]
at php.de.schlund.easc.standalone.EASCInvocationHandler::invoke() [line 31 of EASCInvocationHandler.java]
at php.$Proxy5::search() [line -1 of StackTraceElement.class.php]
at php.sun.reflect.GeneratedMethodAccessor4::invoke() [line -1 of StackTraceElement.class.php]
at php.sun.reflect.DelegatingMethodAccessorImpl::invoke() [line 25 of DelegatingMethodAccessorImpl.java]
at php.java.lang.reflect.Method::invoke() [line 585 of Method.java]
at php.net.xp_framework.easc.server.CallDelegate::invoke() [line 25 of CallDelegate.java]
at php.net.xp_framework.easc.protocol.standard.ServerHandler::handle() [line 73 of ServerHandler.java]
at php.net.xp_framework.easc.server.HandlerThread::run() [line 50 of HandlerThread.java]

```

Example #2
----
Without patch:

```
Exception remote.InvocationException ()
at php.sun.reflect.NativeMethodAccessorImpl::invoke0() [line -2 of NativeMethodAccessorImpl.java]
at php.sun.reflect.NativeMethodAccessorImpl::invoke() [line 39 of NativeMethodAccessorImpl.java]
at php.sun.reflect.DelegatingMethodAccessorImpl::invoke() [line 25 of DelegatingMethodAccessorImpl.java]
at php.java.lang.reflect.Method::invoke() [line 585 of Method.java]
at php.net.xp_framework.easc.server.CallDelegate::invoke() [line 25 of CallDelegate.java]
at php.net.xp_framework.easc.protocol.standard.ServerHandler::handle() [line 73 of ServerHandler.java]
at php.net.xp_framework.easc.server.HandlerThread::run() [line 54 of HandlerThread.java]

```

With patch:

```
Exception remote.InvocationException ()
at php.sun.reflect.NativeMethodAccessorImpl::invoke0() [line -2 of NativeMethodAccessorImpl.java]
at php.sun.reflect.NativeMethodAccessorImpl::invoke() [line 39 of NativeMethodAccessorImpl.java]
at php.sun.reflect.DelegatingMethodAccessorImpl::invoke() [line 25 of DelegatingMethodAccessorImpl.java]
at php.java.lang.reflect.Method::invoke() [line 585 of Method.java]
at php.net.xp_framework.easc.server.CallDelegate::invoke() [line 25 of CallDelegate.java]
at php.net.xp_framework.easc.protocol.standard.ServerHandler::handle() [line 73 of ServerHandler.java]
at php.net.xp_framework.easc.server.HandlerThread::run() [line 54 of HandlerThread.java]
Caused by Exception remote.ExceptionReference (EJBException:; nested exception is:
javax.ejb.EJBException: Store failed; CausedByException is:
Syntax error or access violation message from server: "UPDATE command denied to user 'jboss'@'p4723e3d4.np.schlund.de' for table 'feed'")
at php.org.jboss.ejb.plugins.LogInterceptor::handleException() [line 352 of LogInterceptor.java]
at php.org.jboss.ejb.plugins.LogInterceptor::invoke() [line 196 of LogInterceptor.java]
at php.org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor::invoke() [line 122 of ProxyFactoryFinderInterceptor.java]
at php.org.jboss.ejb.EntityContainer::internalInvoke() [line 514 of EntityContainer.java]
at php.org.jboss.ejb.Container::invoke() [line 873 of Container.java]
at php.sun.reflect.GeneratedMethodAccessor78::invoke() [line -1 of StackTraceElement.class.php]
at php.sun.reflect.DelegatingMethodAccessorImpl::invoke() [line 25 of DelegatingMethodAccessorImpl.java]
at php.java.lang.reflect.Method::invoke() [line 585 of Method.java] thekid@banane:~/devel/xp.public/trunk/ext/java/easc/clients >

```
It is now clear what has caused the problem (a missing update-permission).

Security considerations
====
n/a

Speed impact
====
Slower.

Dependencies
====
n/a

Related documents
====
- http://xp-framework.net/rfc/contrib/rfc0076.diff
Patch