Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

URGENT:Error when using "forward" method of RequestDispatcher

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I am getting "ServletException" while using forward method of RequestDispatcher.
Can anyone suggest the solution for this.
i am using following piece of code.
It gave ServletException at "rd.forward(--)".
------------------------------------
RequestDispatcher rd =
request.getRequestDispatcher("xyz.jsp");
rd.forward(request,response);
return;
------------------------------------
what are all possible ways to get ServletException.
And what is the workaround for this problem?
Pls help.
Thanks in advance ,
Srikanth
 
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A ServletException usually comes with a descriptive string, which you should find in the stack trace. Can you tell us what it is?
 
Raj Sikka
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,Thanks for your prompt response.
here is the stack trace that i obtained.
---------------------------------------
javax.servlet.ServletException
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:256)
at nif.wnf.util.ErrorPage.displayErrorPage(ErrorPage.java:127)
at svm.eug.servlet.EUGControllerServlet.EUGConnectivityModified(EUGControllerServlet.java:2537)
at svm.eug.servlet.EUGControllerServlet.service(EUGControllerServlet.java:123)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:21)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at nif.wnf.filter.SessionFilter.doFilter(SessionFilter.java:88)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2501)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there's nothing below there, giving a "root cause" ?
Is it possible that the page you forwarded to is actually generating the exception?
[ July 23, 2003: Message edited by: Ron Newman ]
 
Raj Sikka
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
That was the only stack trace that i got.
One more thing is ..
"xyz.jsp" is compiled successfully.
I wrote one "out.println()" statement at the first line of that jsp. i couldnt see that line also while executing.
it simply says "ServletException" and it points the line "rd.forward("xyz.jsp")".
what is the problem in forwarding to that jsp ?
pls help,
Srikanth
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this error still happen if you replace the contents of "xyz.jsp" by something simple, like this?
<html>
<head><title>test</title></head>
<body><p>Hello, world!</p></body>
</html>
 
Ranch Hand
Posts: 5397
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is your xyz.jsp is in the same folder where your servlet is residing ??
with this request.getRequestDispatcher("xyz.jsp");
code, server will try to locate xyz.jsp in the directory where servlet is available.
If you have folder structure like..
webApp-->context->jsp->xyz.jsp
then you should use following code:
request.getRequestDispatcher("/jsp/xyz.jsp");
CMIW
HTH
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic