Question: I've faced an interesting aim, this aim targets the exception handling in existing web application written with wicket and hibernate frameworks, 
suppose we have web app which is deployed in server and sometimes it produces runtime exceptions, the problem is how to get and save their stacktrace to db without modifying all classes(about 80 models and 150 views).

Hope i gave all clear.  

Thanks in advance.

Answer: 
You can use an `IRequestCycleListener` to log/handle your exceptions:

```
public class MyExceptionReporter extends AbstractRequestCycleListener {

    @Override
    public IRequestHandler onException(RequestCycle cycle, Exception ex) {
        // log exception here
        return null;
        // if you want to also show an error page:
        // return new RenderPageRequestHandler(new PageProvider(new ExceptionPage(ex)));
    }
}

```

Then register it in `WebApplication#init`:

```
getRequestCycleListeners().add(new MyExceptionReporter());

```
Write a utility which uses StackTraceElement[] to give you the complete stacktrace. Use an implementation of OutputStream to push it to a CLOB object. (I don't think BLOB is needed)