java.lang.NoSuchMethod

2001-10-27 Thread Ben Sifuentes

I'm getting a java.lang.NoSuchMethod error when executing the following:

// Retrieve the context for this object
HttpSession session = req.getSession();
ServletContext context = session.getServletContext();


The error seems to be happening on the call to getServletContext()

The Class that this incures in is instantiated from a servlet and passed the
HttpServletRequest on the call to execute(...) method.

The Class is defined as so:
class MainCommand implements Command {
  private String next;

  public MainCommand(String next) {
this.next = next;
  }

  public String execute(HttpServletRequest req)
throws CommandException {

// Retrieve the context for this object
HttpSession session = req.getSession();
ServletContext context = session.getServletContext();

return next;
  }

}



Does any one have any clue why this would be happening? The call according
to the JDOC is valid.

-Ben




Re: java.lang.NoSuchMethod

2001-10-27 Thread Incze Lajos

On Fri, Oct 26, 2001 at 05:28:43PM -0400, Ben Sifuentes wrote:
 I'm getting a java.lang.NoSuchMethod error when executing the following:
 
 // Retrieve the context for this object
 HttpSession session = req.getSession();
 ServletContext context = session.getServletContext();

Ben,

you're getting java.lang.NoSuchMethod exception when using
session.getServletContext(), because there is No Such Method
in HttpSession.


incze

--
To unsubscribe, e-mail:  mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: java.lang.NoSuchMethod

2001-10-27 Thread Craig R. McClanahan



On Sat, 27 Oct 2001, Incze Lajos wrote:

 Date: Sat, 27 Oct 2001 17:12:26 +0200
 From: Incze Lajos [EMAIL PROTECTED]
 Reply-To: Tomcat Developers Mailing List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Re: java.lang.NoSuchMethod

 On Fri, Oct 26, 2001 at 05:28:43PM -0400, Ben Sifuentes wrote:
  I'm getting a java.lang.NoSuchMethod error when executing the following:
 
  // Retrieve the context for this object
  HttpSession session = req.getSession();
  ServletContext context = session.getServletContext();

 Ben,

 you're getting java.lang.NoSuchMethod exception when using
 session.getServletContext(), because there is No Such Method
 in HttpSession.


That's only true in servlet 2.2 -- it was added in 2.3, so it will work
under Tomcat 4 (as long as your class was compiled against the 2.3 version
of servlet.jar).


 incze


Craig



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]