users@glassfish.java.net

Re: glassfish: getting errors

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Tue, 01 Sep 2009 18:21:32 -0700

Hi Yannick,

On 09/01/09 00:41, ymajoros wrote:

> Hi,
>
> My job includes getting exceptions from glassfish, finding related http
> requests (url, user name, ...), opening a support ticket and assigning all
> of this to the right developer.
>
> Now, for some part of our application, I wrote some generic error page,
> described as such in web.xml, to gather all this information and send it by
> mail. But this is just in 1 of the +-15 war modules.
>
> I would like to do this in glassfish itself. I installed the bits to have
> exceptions sent by mail. I would still like to have the corresponding http
> requests sent along with it. Is there some way I can do that?
>

It sounds like the "send-error_<n>" virtual-server property is what you
are looking for.

See

  http://forums.java.net/jive/message.jspa?messageID=278954

for an explanation of this property, including an example.

The syntax is as follows:

<property name="send-error_1" value="path=<resource_1>
reason=<reason-string_1> code=<error-code_1>"/>
<property name="send-error_2" value="path=<resource_2>
reason=<reason-string_2> code=<error-code_2>"/>
[...]

where "path" is the absolute or relative (to the domain's config
directory) path to the error page,
"reason" the reason string to be included in the error response, and
"code" the error status code
that is supposed to be handled by the error page.

This property takes effect for a virtual server's root context as well
as any apps deployed to it,
unless overridden by an error page declaration in an app's web.xml.

Let me know if you have any questions.

Thanks,

Jan

> Yannick
>