Java Client - Get Server-Side Stack Trace

Version 4.1 by David Avendasora on 2008/01/16 15:53

When you use the invokeRemoteMethod() method on a client-side EO and an error is generated on the server, you will normally only get a client-side stack-trace such as:


Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Server exception: null
at com.webobjects.eodistribution.client.EODistributedObjectStore._checkReturnValuesForExceptions(EODistributedObjectStore.java:569)
at com.webobjects.eodistribution.client.EODistributedObjectStore._send(EODistributedObjectStore.java:597)
at com.webobjects.eodistribution.client.EODistributedObjectStore.invokeRemoteMethod(EODistributedObjectStore.java:968)
at com.webobjects.eodistribution.client.EODistributedObjectStore.invokeRemoteMethod(EODistributedObjectStore.java:923)
at com.webobjects.eocontrol.EOEditingContext.invokeRemoteMethod(EOEditingContext.java:5126)
       <snip>

Add the following:


// Enable stack trace logging in the event of a sever-side exception
NSLog.allowDebugLoggingForGroups(NSLog.DebugGroupIO);

// Enable stack trace logging for the EnterpriseObjects group
NSLog.allowDebugLoggingForGroups(NSLog.DebugGroupEnterpriseObjects);

to your Application class's main(String argv[]) method prior to:


WOApplication.main(argv, Application.class);

This will send the server-side stack trace to the Run Log of your application as well as still having the Client-Side stack trace in the console of the client.

thanks to Pierre Bernard