You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Ben Sifuentes <be...@intechpro.com> on 2001/10/26 23:28:43 UTC
java.lang.NoSuchMethod
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
Posted by Incze Lajos <in...@mail.matav.hu>.
On Mon, Oct 29, 2001 at 09:03:42AM -0500, Ben Sifuentes wrote:
> Also, I was wondering is there a standard api which returns the version of
> the container? (i.e. 2.2 versus 2.3)
>
> -Ben
What you've done was a fairly good method to decide between the 2.3
servlet engine and the ante. OK. After the joke:
ServletContext has a getMajorVersion and getMinorVersion method.
incze
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: java.lang.NoSuchMethod
Posted by Ben Sifuentes <be...@intechpro.com>.
Also, I was wondering is there a standard api which returns the version of
the container? (i.e. 2.2 versus 2.3)
-Ben
-----Original Message-----
From: Ben Sifuentes [mailto:ben.sifuentes@intechpro.com]
Sent: Sunday, October 28, 2001 10:12 PM
To: Tomcat Developers List
Subject: RE: java.lang.NoSuchMethod
I see, I was compiling using j2sdkee1.3 and running against Tomcat3.3-rc3
thats must run a 2.2 container?
Thanks,
-Ben
-----Original Message-----
From: Incze Lajos [mailto:incze@mail.matav.hu]
Sent: Sunday, October 28, 2001 8:33 PM
To: Tomcat Developers List
Subject: Re: java.lang.NoSuchMethod
On Sat, Oct 27, 2001 at 12:07:52PM -0700, Craig R. McClanahan wrote:
>
>
> On Sat, 27 Oct 2001, Incze Lajos wrote:
>
> > Date: Sat, 27 Oct 2001 17:12:26 +0200
> > From: Incze Lajos <in...@mail.matav.hu>
> > Reply-To: Tomcat Developers Mailing List <to...@jakarta.apache.org>
> > To: tomcat-dev@jakarta.apache.org
> > 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
Sorry Ben, I was wrong. Probably you compiled against a 2.3 servlet.jar then
dropped your app into a 2.2 servlet container.
incze
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: java.lang.NoSuchMethod
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Sun, 28 Oct 2001, Ben Sifuentes wrote:
> Date: Sun, 28 Oct 2001 22:12:21 -0500
> From: Ben Sifuentes <be...@intechpro.com>
> Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
> To: Tomcat Developers List <to...@jakarta.apache.org>
> Subject: RE: java.lang.NoSuchMethod
>
> I see, I was compiling using j2sdkee1.3 and running against Tomcat3.3-rc3
> thats must run a 2.2 container?
>
J2EE 1.3 is Servlet 2.3/JSP 1.2 based (it has Tomcat 4 embedded inside).
In general, you should compile servlets against the servlet.jar (or
equivalent) of the container you are going to run them on.
> Thanks,
> -Ben
>
Craig
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: java.lang.NoSuchMethod
Posted by Ben Sifuentes <be...@intechpro.com>.
I see, I was compiling using j2sdkee1.3 and running against Tomcat3.3-rc3
thats must run a 2.2 container?
Thanks,
-Ben
-----Original Message-----
From: Incze Lajos [mailto:incze@mail.matav.hu]
Sent: Sunday, October 28, 2001 8:33 PM
To: Tomcat Developers List
Subject: Re: java.lang.NoSuchMethod
On Sat, Oct 27, 2001 at 12:07:52PM -0700, Craig R. McClanahan wrote:
>
>
> On Sat, 27 Oct 2001, Incze Lajos wrote:
>
> > Date: Sat, 27 Oct 2001 17:12:26 +0200
> > From: Incze Lajos <in...@mail.matav.hu>
> > Reply-To: Tomcat Developers Mailing List <to...@jakarta.apache.org>
> > To: tomcat-dev@jakarta.apache.org
> > 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
Sorry Ben, I was wrong. Probably you compiled against a 2.3 servlet.jar then
dropped your app into a 2.2 servlet container.
incze
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: java.lang.NoSuchMethod
Posted by Incze Lajos <in...@mail.matav.hu>.
On Sat, Oct 27, 2001 at 12:07:52PM -0700, Craig R. McClanahan wrote:
>
>
> On Sat, 27 Oct 2001, Incze Lajos wrote:
>
> > Date: Sat, 27 Oct 2001 17:12:26 +0200
> > From: Incze Lajos <in...@mail.matav.hu>
> > Reply-To: Tomcat Developers Mailing List <to...@jakarta.apache.org>
> > To: tomcat-dev@jakarta.apache.org
> > 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
Sorry Ben, I was wrong. Probably you compiled against a 2.3 servlet.jar then
dropped your app into a 2.2 servlet container.
incze
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: java.lang.NoSuchMethod
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Sat, 27 Oct 2001, Incze Lajos wrote:
> Date: Sat, 27 Oct 2001 17:12:26 +0200
> From: Incze Lajos <in...@mail.matav.hu>
> Reply-To: Tomcat Developers Mailing List <to...@jakarta.apache.org>
> To: tomcat-dev@jakarta.apache.org
> 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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: java.lang.NoSuchMethod
Posted by Incze Lajos <in...@mail.matav.hu>.
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>