• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

error-page specified in DD not displayed

 
Ranch Hand
Posts: 163
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've seen this happen when the error page itself contains an error. Is that a possibility here?
 
Bill Clar
Ranch Hand
Posts: 163
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 163
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it work if you do not precompile?
 
Bill Clar
Ranch Hand
Posts: 163
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 163
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 163
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic