LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   RequestDispatcher forword (https://www.linuxquestions.org/questions/linux-server-73/requestdispatcher-forword-868844/)

Jerry Mcguire 03-16-2011 01:56 AM

RequestDispatcher forword
 
Hi all,

I have a web app that generates an exception in the web browser:

Code:

exception

org.apache.jasper.JasperException: Unable to compile class for JSP:

Stacktrace:
        org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
        org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
        org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
        org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
...

My trace to the java source code says the problem occurs at the following line:
Code:

public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
    ...
    RequestDispatcher rd = sc.getRequestDispatcher(url);
    System.out.println("[DEBUG]" + url);
    if (rd != null)
        rd.forward(req, res);  // This line generates the exception
    else
        System.out.println("[DEBUG]rd is null");
}

Other information:
Code:

$ echo $CLASSPATH
.:/usr/share/tomcat5/common/lib:/usr/share/tomcat5/common/lib/servlet.jar
$ java -version
java version "1.6.0"
OpenJDK  Runtime Environment (build 1.6.0-b09)
OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode)

Can anyone tell me what I have done wrong? How to make it work? Please.

btw, the same app works in Tomcat6 with SunJDK. I'm using Tomcat5.5 and OpenJDK.

Thanks.

Jerry Mcguire 03-16-2011 04:17 AM

Thanks for viewing.

The problem is solved with the advice from amit punekar and friends from
JavaRanch


All times are GMT -5. The time now is 06:15 AM.