Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<error-page> tag in web.xml is not working

 
Ruturaj Varne
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Following tag in web.xml is not working for me. I am using Tomcat 5.5 and JDK 5.

<error-page>
<exception-type>java.lang.NullPointerException</exception-type>
<location>/UserAuthentication/error.html</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/UserAuthentication/error.html</location>
</error-page>

Instead of showing the error.html, I am getting 404 Page not found on Browser.

Please guide me on this.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Details. We always need details!

Which browser? If it's IE, that's a known problem with IE.
 
Ruturaj Varne
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.. It is IE 7. But I tried the same thing on Mozilla Firefox Browser also and getting the same result.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the file /UserAuthentication/error.html exist relative to the context root?
 
Ruturaj Varne
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then it should work.

If all you are going to give is single-word answers, there's not much else to say.
 
Ruturaj Varne
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I placed error.html inside the Userauthentication directory of Tomcat/ Webapps. I thought that /UserAuthentication/error.html will not work. So hit this link in browser just to confirm that the path is correct. I read one thread in this forum which tells that there is need of change in configuration of IE. That also i tried but the output is same. BLANK PAGE. So i think everything is at its proper place. So i am confused now and having only one question in mind that WHY THIS IS NOT WORKING.
I am expecting whenever there is 404 error then browser should show me the error.html. But it is not showing anything. Now please tell me.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ruturaj Varne wrote:Well, I placed error.html inside the Userauthentication directory of Tomcat/ Webapps.

Then you answered my question incorrectly. The file path is not relative to the context root. This is why a single-word answer isn't a good idea.

If /UserAuthentication is the context path, it doesn't get specified as part of the file path. The container knowns where the context path is; you don't repeat it.
 
Ruturaj Varne
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now i tried the following

<error-page>
<exception-type>java.lang.NullPointerException</exception-type>
<location>/error.html</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error.html</location>
</error-page>

Still it is not working.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You changed 404 to 500. Are you seriously looking for help, or just yanking chains?
 
Ruturaj Varne
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added both of them (404 and 500). I am just doing some R&D work so that this <error-page> thing will work. Thats why i added 500.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to post your web app file structure and the deployment descriptor. Please be sure to use code tags to preserve formatting.
 
Ruturaj Varne
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
send me your mail id ... i will send you everything..
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UseTheForumNotEmail. You'll get more help by posting your directory structure and deployment descriptor here.
 
Ruturaj Varne
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is an attachment of web.xml.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot attach such file. Please copy/paste it here. (Insert it between [code] [/code] tags)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic