Here is the relevant code fragment:
...
session.putValue("userName", sLoginName); // Save valid user name
// now we need to transfer the control to another servlet
debug("Attempting getRequestDispatcher()");
RequestDispatcher rd =
getServletContext().getRequestDispatcher("/servlet/IsItWorking");
debug("doPost() - return from getRequestDispatcher()");
if (rd != null)
{
rd.forward(request,response);
}
When I compile this code, I get this deprecation warning:
Warning: method putValue(java.lang.String, java.lang.Object)
in interface javax.servlet.http.HttpSession has been deprecated.
This may give a clue as to the version of the servlet engine I'm
using.
When I execute the servlet, I am getting the following in 'jserv.log':
attempting getRequestDispatcher()
java.lang.NoSuchMethodError: javax.servlet.ServletContext:
method
getRequestDispatcher(Ljava/lang/String;)Ljavax/servlet/RequestDispatcher;
not found
at
org.apache.jserv.JServConnection.processRequest(JServConnection.java:320)
at
org.apache.jserv.JServConnection.run(JServConnection.java:188)
at java.lang.Thread.run(Thread.java:479)
This has occupied me for most of yesterday and today - all suggestions
very gratefully accepted please!
TIA
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, y...@your.address and inform
them of the time the error occurred, and anything you might have
done that may have caused the error.
More information about this error may be available in the server
error log.
Jeremy Russell <jeremy....@usa.net> wrote:
> I am attempting to write a typical login servlet, that will then
> forward control to another servlet after a successful entry of a login
> name and password. The environment I am using is an Oracle 9i
> database on Windows 2000, together with the Apache and jar files
> supplied by Oracle.
>
> Here is the relevant code fragment:
>
> ...
> session.putValue("userName", sLoginName); // Save valid user name
> // now we need to transfer the control to another servlet
> debug("Attempting getRequestDispatcher()");
> RequestDispatcher rd =
> getServletContext().getRequestDispatcher("/servlet/IsItWorking");
> debug("doPost() - return from getRequestDispatcher()");
>
> if (rd != null)
> {
> rd.forward(request,response);
> }
>
> When I compile this code, I get this deprecation warning:
>
> Warning: method putValue(java.lang.String, java.lang.Object)
> in interface javax.servlet.http.HttpSession has been deprecated.
>
> This may give a clue as to the version of the servlet engine I'm
> using.
Nope, that gives a clue as to the verison of the servlet API you're
*compiling* against. That may or may not be the same as your actual
runtime servlet engine.
> When I execute the servlet, I am getting the following in 'jserv.log':
>
> attempting getRequestDispatcher()
> java.lang.NoSuchMethodError: javax.servlet.ServletContext:
> method
> getRequestDispatcher(Ljava/lang/String;)Ljavax/servlet/RequestDispatcher;
>
> not found
> at
> org.apache.jserv.JServConnection.processRequest(JServConnection.java:320)
So, you're using JServ at runtime. JServ only implements v2.0 of the
servlet API, which doesn't have ServletContext.getRequestDispatcher.
You'll either have to not use it, or change servlet engine.
--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
>(There's no need to crosspost, btw. Most of the people answering tend to
>read both of the groups you asked in.)
Ooops. No more x-posting then.
Thanks for the info - is there no corresponding mechanism in Jserv
then?
I don't know, to be honest - I don't believe so. Any reason not to
upgrade to Tomcat?
>Jeremy Russell <jeremy....@usa.net> wrote:
>> Thanks for the info - is there no corresponding mechanism in Jserv
>> then?
>
>I don't know, to be honest - I don't believe so. Any reason not to
>upgrade to Tomcat?
I guess not - just nervous about breaking what I do have working. But
I'm trying to figure out how to upgrade now ...
I'm downloading a JSDK 1.3 and Tomcat 4.0 - hopefully, that's gonna do
it. Am I correct in thinking that I need to install the JDK, then
Tomcat - stop my Apache service and start the Tomcat? In that order?
Jeremy
Sure, but the upgrade is a bit more complicated than that. JServ and
Tomcat provide considerably different environments: JServ's is an ad hoc
kind of thing that relates specifically to that container, whereas Tomcat
provides the standard 2.2 servlet web application environment. As a
result, all your servlet "zone" configuration, the /servlet/* URLs, and
the like will no longer apply. Instead, you'll have a WEB-INF/web.xml
file in your web application that maps servlets to URLs.
The Servlet API itself is pretty much backward-compatible, though version
2.1 deprecated and intentionally broke several features... if you compile
against a newer version of the API, you'll get deprecation warnings if
you use these. (They aren't particularly useful, so it's doubtful that
you do).
Chris Smith
Stop *everything*, install the JDK, then get Tomcat working *without*
Apache. Then work out how to connect up Apache to Tomcat afterwards.
OK, I'm working on getting my brain around this, but would appreciate
a little more help on getting this setup right.
Does Tomcat standalone serve both HTML and servlet purposes? If so,
why would I need Apache with embedded Tomcat?
My brain hurts ...
FWIW, I always try to ensure that I compile against the servlet.jar file
from the servlet engine that I'm using. That may not be practical in all
cases, but it could certainly save a lot of confusion if Jeremy could manage
it.
Luke
And Jeremy's gonna try - if'n this stuff EVER downloads :(
I actually thought I was using the same JAR file and it was only when
this all started that I determined I was wrrrr... I was wrrrrooo ... I
wasn't correct in that assumption.
Cheers, Luk
>"Jon Skeet" <sk...@pobox.com> wrote in message
Whoa - that was Freudian - for "Luk" in the previous message, read
"Luke".
It does do both, and you don't need Apache... unless you want access to
advanced features of Apache that Tomcat doesn't provide.
Chris Smith
> OK, I'm working on getting my brain around this, but would appreciate
> a little more help on getting this setup right.
>
> Does Tomcat standalone serve both HTML and servlet purposes?
Yup.
> If so, why would I need Apache with embedded Tomcat?
Apache will generally be more efficient than Tomcat for static content,
and you can then use its various other modules.
On the other hand, if Tomcat does all you need it to, feel free to stick
just to Tomcat.
True, but neither one is particularly impressive in the performance department.
Not that it matters if you have fewer than 10e6 requests/day.
Marshall