null RequestDispatcher

I have a jsp error page to handle exceptions when a exception occurs inside a servlet, I'm running my servlet in Oracle Apllication Server 10g and all runs fine, but when we decided to change the application server to SJSAS 9 I get a null RequestDispatcher when I'm trying to redirect to the error page when the exception occurs, there's the code:

catch (NullPointerException npe){

request.setAttribute("javax.servlet.jsp.jspException", npe);

RequestDispatcher rqd = request.getRequestDispatcher("../error.jsp?barra=si");

rqd.forward(request,response);

}

I have the error page in root directory and the servlets has a context path like /sistema/ServletName and because I nedd to use relative path to access the error page from the servlet I use a relative path in getRequestDispatcher.

I suppose the get the NullPointerException because the path of the error page is wrong formed but in Oracle Application Server run well.

[1110 byte] By [luiguisfa] at [2007-11-27 10:16:43]
# 1

Instead of using the request.getRequestDispatcher use the servletContext.getRequestDispatcher. This RequestDispatcher :

"The pathname must begin with a "/" and is interpreted as relative to the current context root. Use getContext to obtain a RequestDispatcher for resources in foreign contexts. This method returns null if the ServletContext cannot return a RequestDispatcher."

http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)

tolmanka at 2007-7-28 15:47:15 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I change my code to use getServletContext().getRequestDispatcher(String) but I get the same error, the RequestDipatcher is null.

I change my jsp error page for a servlet and works well, but I have a doubt of why I get a null RequestDipatcher.

luiguisfa at 2007-7-28 15:47:15 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...