I have one application deployed on JBoss 7.x under the context root "helloworld" that has:
welcome.jsp and error.jsp.
The custom error page specified in the web.xml DD as:
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
when I access the page as:
http://localhost:8080/helloworld/welcome.jsp
I get the page as expected.
http://localhost:8080/helloworld/welcome_does_not_exist.jsp
takes me to:
http://localhost:8080/helloworld/error.jsp
however
http://localhost:8080/helloworld_DOES_NOT_EXIST/welcome.jsp
does not take me to the custom error page but shows:
========
HTTP Status 404 - /helloworld_DOES_NOT_EXIST/welcome.jsp
type Status report
message /helloworld_DOES_NOT_EXIST/welcome.jsp
description The requested resource (/helloworld_DOES_NOT_EXIST/welcome.jsp)
is not available.
JBoss Web/7.0.13.Final
=========
Could you please let me know how to set the error page so that even when we specify the wrong context root we get the custom error page?
Thanks.
Related
I have a Polymer app running on port 5901 of my VM, and am using Apache reverse proxy to serve the app from the following URL:
http://www.example.com/polymer
The problem is when I go to the URL in a browser, I can see the page title but the page is blank. I also get this error in the console:
Failed to load resource: the server responded with a status of 404 (Not Found) src/home-page.html
I'm assuming that I have to somehow add the /polymer subdomain to the default URL for the app, but I'm not sure how to do this.
EDIT: In response to comment:
The relevant link for Polymer 2.0 routing is https://www.polymer-project.org/2.0/toolbox/routing .
Updating the route. The route object is read-write, so you can use two-way data binding or this.set to update the route. Both the route and routeData objects can be manipulated this way. For example:
this.set('route.path', '/search/');
Or:
this.set('routeData.user', 'mary');
WSO2 Identity Server 5.0.0
For things such as a 500 errors and anything unforeseen, I'd like to configure my Identity Server instance to have our own branded error page to hide the server technology for security reasons and also just allow the error a little confusion.
At any rate, this no help: https://docs.wso2.com/display/IS500/Customizing+Error+Messages
I tried editing /repository/conf/tomcat/carbon/WEB-INF/web.xml and added the standard way to define an error page for exceptions:
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/NiceError.jsp</location>
</error-page>
and then placed NiceError.jsp in /repository/conf/tomcat/carbon/
So when I make a 500 error reoccurr, things change, but I'm sent to the carbon management console login page. If I decide to login, I get served up with an 405 error like so:
HTTP Status 405 - HTTP method GET is not supported by this URL
type Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource.
Apache Tomcat/7.0.55
The URL looks like: https://hostname:9443/NiceError.jsp?sessionDataKey=eabd6c25-7c79-40a9-af87-3cd80a68367e&loginStatus=true
That doesn't help.
How can this kind of thing be setup to work? It can't be hard with the right information. Right? :)
The referred documentation page is to customize error messages for identity related errors as its name sounds. It is not to create custom error pages.
By the way if you need to create custom error page, which is applicable to all web applications in your server instance, you may need to add your error page to web.xml in /repository/conf/tomcat/ directory. It defines default values for all web applications loaded into your instance of Tomcat. As each application get deployed, above file is processed, followed by the /WEB-INF/web.xml deployment descriptor from your own applications.
Thanks
To redirect user to an error page I am adding entry in web.xml for 401 (Unauthorized) error code. But I don't find it correct. As, I am adding following code in web.xml which is in framework.
<error-page>
<error-code>401</error-code>
<location>/myapp/Error/Error401.html</location>
</error-page>
And, What if there are more than one component in my application and I want to redirect on different error pages on same error code as per component. Please guide me as to how can I achieve the same?
Thanks in advance.
I have a JAX-RS application deployed on JBoss AS 7.1.1.
In the web.xml file I configured custom error pages:
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>
It's working ok for 404 (no found) errors.
However, for 500 (internal server error), it doesn't work as expected:
if my method throws an Exception, then my custom error page is displayed
however, if I use in my method return Response.serverError.build()
or return Response.status(500).build() then the default JBoss error page is displayed instead of my custom one!
How can I fix this?
Thank you for your answers.
ExceptionMapper impl class catches the exception instead of letting the custom error page to be resolved from web.xml
The resolution would be to remove the ExceptionMapper impl class.
I have a Joomla site running on Apache and Ubuntu 12.04. I wanted to show a custom 404 pages to be shown when a 404 error occure. I have made necessary changes to error.php file in my template directory to redirect it to '/404' directory where I have an index.html file with many images,css and java script.
Now when accessing a non-existent page, Joomla is redirecting me to root/404 but there I get a 403 Forbidden error from appache. The 404 directory is located inside 'htdocs' directory of Joomla installation.
Additional info:
1. I don't want to convert my 404 page into a Joomla template or article.
2. I am using a Joomla AMI from Bitnami on Amazon web service
If you redirect to a 404 page, you corrupt the error mechanism. The client will never get that 404 status, but a 200 on successful redirect to your error page.
Instead, you should modify your template's error.php to
send the 404 Not Found header
directly send the error page using readfile()
You might have to adjust the asset paths within your error page.
That's totally wrong, working with static pages does not mean that you have to overcome Joomla's routing.
You should either override the error Page view or use custom error pages.
Take a look at Joomla's documentation.http://docs.joomla.org/Custom_error_pages
Nibra was totally right about breaking the mechanism but still using a readfile() seems as an overkill.