Cannot disable Jetty Stack traces

Description

I'm using Karaf 2.2.2 and with Pax Web 1.0.4. My application includes several WAB bundles.

When the OSGI container is starting up, and you attempt access the application too soon, you get a Jetty 500 error page with a ugly stack trace. Then if you try again after everything is started it works fine. I really don't want customers to see that stack trace while the application is loading. Is it possible to disable Jetty stack traces?

In order to get around this temporarily hacked the code HttpServiceContext to the following:

ErrorPageErrorHandler errorHandler = new ErrorPageErrorHandler();
errorHandler.setShowStacks(false);
setErrorHandler( errorHandler );

This works, but it would be nice if there was a cleaner way.

Environment

None

Activity

Show:
Achim Nierbeck
April 27, 2012, 10:18 PM

Actually after thinking about this a bit longer and taking a look at the "best practices" here
I think it's best to register a special ErrorPage for this.
That's why I won't fix this for 2.0.0
if you think this is a reasonable solution please mark this issue as won't fix and fix version (non fixable) thanks

Jean-Baptiste Onofre
September 11, 2019, 4:31 PM

It's possible to provide a error handler bean to control that:

However, it requires for the user to register its own bundle.

I propose to add a flag in org.ops4j.pax.web.cfg configuration (stacktrace.disabled for instance) that "inject" a Pax Web error handler if true.

Jean-Baptiste Onofre
September 12, 2019, 1:52 PM

I already have the change ready for 7.3.x branch. Iโ€™m preparing both 7.2.11 and 7.3.4 releases (even if Iโ€™m pretty busy here at ApacheCon ๐Ÿ˜‰ ).

Grzegorz Grzybek
September 12, 2019, 2:13 PM

Please excuse my eagerness .

Jean-Baptiste Onofre
October 24, 2019, 6:00 AM

I added a property, but for the record, itโ€™s possible to disable stack trace with jetty configuration like this:

{code}

<Get name="errorHandler">

<Call name="setShowStacks"> <!-- Here -->

<Arg type="boolean">false</Arg>

</Call>

</Get>

{code}

Assignee

Jean-Baptiste Onofre

Reporter

Jeremy Erdmann

Labels

None

Components

Fix versions

Priority

Major
Configure