• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

forward call failed

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my apllication the forward of requestdispatcher is failing.
I have a code somthing like this
<code>
XXXXX.forward(X.jsp,servlet, req, resp);
</code>
intresting part is though i get "forward call failed " on server console, the user is forwarded to X.jsp without any error on browser side.
This is the logout page of my application before which i am invalidating the session. Can this cause problem ?
Anybody happened to experience such thing , please help
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

In my copy of the JavaDocs for RequestDispatcher the forward method looks like this:

so I suspect you are not showing us the real code.
Bill
 
Dhondiba Joshi
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes William

Sorry for showing my wrapper 'forward' method instead of underlying forward method. But i am finally using the same forward method which takes request and response as parameter.
The code is:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import net.eventdriven.*;
public class LogoutAction extends EpatsAction {
public void perform(
HttpServlet servlet,
HttpSession session,
HttpServletRequest req,
HttpServletResponse resp)
throws ServletException, IOException, EdcException {

if (session != null)
{
session.invalidate();
}
else
{
ServletConfig sc = servlet.getServletConfig();
sc.getServletContext().log("session was null already");

}
/* this call is failing */
forward("Logout.jsp",servlet, req, resp);

}
}
It goes in the if block invalidates the session and then forward call fails.
Help !
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You still have not shown the code that is failing. We are not mindreaders.
If you see "forward call failed" on the console, it must be written by your forward code since the RequestDispatcher forward just throws an IOException.
Bill
(actually I am getting a vision.... yes... since the user is actually forwarded to the jsp, you have a logic error that comes after the forward call .... )
 
Dhondiba Joshi
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi William !
This is the underlying code that is giving the error. I know i was slow on this to reply.Please help.
The problem here is i get an error saying "forward call failed" but user is forawrded to the page without any problem. Any bod yhas gone through such situation.
<code>
ServletContext app = servlet.getServletContext();
String jspPath = app.getInitParameter("jspPath");
if (jspPath == null)
jspPath = "";
RequestDispatcher rd = req.getRequestDispatcher(jspPath + jsp);
if(rd == null) app.log("rd is null!!!" );
rd.forward(req, resp);
</code>
 
Dhondiba Joshi
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made sure that 'jsppath' is correct and 'rd' is not null.
Can it be an errors in the jsp page to which call is forwarded ?
Thanks in advance
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If this was my problem I would concentrate on finding out where the "forward call failed" message is actually coming from. In cases like this I actually just do a bulk search of all files in my source code, and if that fails, the entire set of server directories for the text.
If the message is appearing on your console it is probably being written by a System.out.print somewhere. Again, if the user is actually forwarded, you probably have a logic error after the forward call.
Bill
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic