0

I am trying to redirect to a custom error.jsp page but I get the following not found page (looks like it is unable to locate error.jsp file). error page

Location of my error.jsp file : project_root_dir --> src --> main --> webapp --> WEB-INF

web.xml : Present at : project_root_dir --> src --> main --> webapp --> WEB-INF

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
         
    <display-name>Archetype Created Web Application</display-name>
    <servlet>
        <servlet-name>REST</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        
        <init-param>
            <param-name>jersey.config.server.provider.classnames</param-name>
             <param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value>
        </init-param>

        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>REST</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

    <error-page>
        <error-code>404</error-code>
        <location>/error.jsp</location>
    </error-page>
    
    <error-page>
        <error-code>403</error-code>
        <location>/error.jsp</location>
    </error-page>   
    
    <error-page>
        <error-code>500</error-code>
        <location>/error.jsp</location>
    </error-page>
    
    <error-page>
        <error-code>400</error-code>
        <location>/error.jsp</location>
    </error-page>
</web-app>

error.jsp file :

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" isErrorPage="true"%>    
<!DOCTYPE html>
<html>
    <head>
        <meta charset="ISO-8859-1">
        <title>404-Page Not Found</title>
    </head>
    <body>
        Error!
    </body>
</html>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555

0 Answers0