aspose file tools*
The moose likes JSP and the fly likes error-page specified in DD not displayed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "error-page specified in DD not displayed" Watch "error-page specified in DD not displayed" New topic
Author

error-page specified in DD not displayed

Bill Clar
Ranch Hand

Joined: Sep 21, 2006
Posts: 153

I'm trying to catch a javax.el.PropertyNotFoundException error in my JSPs. I see the exception in the logs, but the screen displays blank. Nothing. No html source. No messages. A white screen of camouflaged polar bears.

Here's my error-page in the DD:



I'm using Tomcat 7.0.6. I'm precompiling the JSPs with org.apache.jasper.JspC and I can verify that the elError.jsp is compiled and deployed to the WEB-INF/lib directory.

I googled and searched for an answer, but no luck.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

I've seen this happen when the error page itself contains an error. Is that a possibility here?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bill Clar
Ranch Hand

Joined: Sep 21, 2006
Posts: 153

Bear Bibeault wrote:I've seen this happen when the error page itself contains an error. Is that a possibility here?


Not sure.

I stripped out all directives and EL from the error page and I still get a white screen. All that's in the error page at this point is pure html. No includes or javascript.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

Ah! WEB-INF/lib? (missed that on first read). Why is it there?

According to your DD, it should be in the context root.
Bill Clar
Ranch Hand

Joined: Sep 21, 2006
Posts: 153

Bear Bibeault wrote:Ah! WEB-INF/lib? (missed that on first read). Why is it there?

According to your DD, it should be in the context root.


All the precompiled JSP classes are stored in a jar file in WEB-INF/lib. I've never had a problem with this approach as there are other error pages (error codes only - no exceptions) at the root level.

Just in case, I did put elError.jsp at the root level. Same result.

I did find this thread on StackOverflow, but his problem was caused by an intercepting filter. I don't have any filters on my application.

In the meantime, I'm going to create an error page for an ArithmeticException like the example in Head First Servlets and JSP. I want to ensure that Tomcat can find an error page for a specific exception.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

Does it work if you do not precompile?
Bill Clar
Ranch Hand

Joined: Sep 21, 2006
Posts: 153

Bear Bibeault wrote:Does it work if you do not precompile?


I put the uncompiled jsp in the root directory. No luck.

I also tried the ArithmeticException error page and it didn't find it either. Seems like Tomcat doesn't like the Exception pages.

Yet, Tomcat can find my error code pages without a problem:



Bill Clar
Ranch Hand

Joined: Sep 21, 2006
Posts: 153

I found this answer on StackOverflow:


I seem to recall that the error page mechanism is disabled during the invocation of a filter's doFilter method.
You might consider having an outer-most filter act as your own error page handler.

Additional info based on comment:
The error page mechanism is disabled for the request because it is being processed by one or more filters (e.g. IPControlFilter and SessionAuthFilter).
It doesn't have anything to do with applying a filter to your error page. The "outer-most filter" I mentioned would be mapped to /* and would simply do something like:




I am forwarding the request to the JSP which contains the EL error. The only Filter I see in the stack trace is org.apache.catalina.core.ApplicationFilterChain.doFilter().
Bill Clar
Ranch Hand

Joined: Sep 21, 2006
Posts: 153

That did the trick! The DD error-page isn't picked up if the request comes from a servlet. I caught the exception in the servlet and forwarded the request directly to the error page.

Thanks for your help, Bear!
 
 
subject: error-page specified in DD not displayed