Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change default error page(status 404 - not found) in GlassFish 3.0.1 Community Edition?

How to change default error page(status 404 - not found) in GlassFish 3.0.1 Community Edition?

like image 416
gennad Avatar asked Sep 20 '10 12:09

gennad


2 Answers

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

enter image description hereenter image description hereenter image description here

like image 139
ahmet Avatar answered Oct 11 '22 12:10

ahmet


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/

like image 20
javadude Avatar answered Oct 11 '22 12:10

javadude