Skip to content

Instantly share code, notes, and snippets.

@lucasduete
Last active January 7, 2020 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasduete/b774e1a6385c381feab6807c9d5a9090 to your computer and use it in GitHub Desktop.
Save lucasduete/b774e1a6385c381feab6807c9d5a9090 to your computer and use it in GitHub Desktop.
How to change default error page(status 404 - not found) in GlassFish
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
image 1: http://i.stack.imgur.com/MR8HS.png
image 2: http://i.stack.imgur.com/6bCO3.png
image 3: http://i.stack.imgur.com/aQjyD.png
Original Link: https://stackoverflow.com/questions/3751566/how-to-change-default-error-pagestatus-404-not-found-in-glassfish-3-0-1-comm/13585292#13585292
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment