users@glassfish.java.net

error handling in ear

From: <glassfish_at_javadesktop.org>
Date: Tue, 01 Jun 2010 07:28:09 PDT

Hi,

We have an application consisting of multiple ejb and war modules, packaged in an ear file.

Some web module intercepts error using web.xml error-page property. When an exception occurs, details are put in db (using some ejb), and an error description form is displayed to the user. If filled, the description is added to db.

Now, I'd like to share this error form between all war modules (10+). I really don't want to copy the code x times, for obvious reasons.

Here are some options I considered and why I think they won't work, after some experimentation:

- using send-error_n property in domain.xml --> only html pages
- a simple error servlet which I'd put in a library jar and define in default-web.xml --> no ejb injection (for persistence) ; can't transfer the stack trace I want to persist easily between war modules (different sessions, found no way to share)

If we had jsf 2 support (which doesn't work right now for our application due to lib conflicts), I could package some jsf pages in a jar and use that between war's... That's part of the standard. I'm not sure about jsf 1.2, but I don't think it's easily feasible, and we have multiple jsf implementations and libs which are a nightmare to maintain (jsp/facelets, icefaces/tomahawk). So, this last option is difficult, as long as we don't unify our technologies (we are planning to have icefaces 2 on jsf 2 when available).

So, I think I need a way to have a central error page in one of the wars, maybe with some kind of redirect, that still has access to the username, http request, ...

Any solution, even in another direction?
[Message sent by forum member 'ymajoros']

http://forums.java.net/jive/thread.jspa?messageID=472271