How to change default error page(status 404 - not found) in GlassFish 3.0.1 Community Edition?
Create a page 404.htm
Ex:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>404 - Page not found.</title>
<style type="text/css">
body{
font-family:tahoma;
}
</style>
</head>
<body>
<div class="firstWarning">Page not found.</div>
<img src="css/images/404.jpg" class="imgWarning" />
</body>
</html>
and save it as 404.htm and put it to your
${com.sun.aas.instanceRoot}/docroot/
Ex:
/usr/share/glassfish3/glassfish/domains/domain1/docroot/
Enter:
https://ip_address:4848/web/configuration/virtualServerEdit.jsf?name=server&configName=server-config
Add new property to server
Name:send-error_1
Value:code=404 path=${com.sun.aas.instanceRoot}/docroot/404.htm reason=Resource_not_found
Description: 404 Error Page
I recommend using the glassfish console and add a property here:
Configuration|Virtual Server|server
name: send-error_1
value: code=404 path=/tmp/404.html reason=Resource_not_found
Increase the number for several errors, eg. send_error_2,3,4...
Paths are either absolute or relative to your domain folder.
Have a look at http://javadude.wordpress.com/2010/12/07/customized-error-pages-for-glassfish-v3/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With