|
 |
apache_tomcat thread: Re: HTTP Status 500 - Unable to Execute Servlet in Tomcat
Message #1 by "Robin Rembish" <rhrembish@c...> on Fri, 7 Feb 2003 20:53:59
|
|
Ben,
Thank you for responding. I uncommented the invoker servlet under
CATALINA_HOME/conf/web.xml rather than include the servlet information in
the folder's web.xml file. When placing the project on a server (not
Tomcat), is it necessary to populate the web.xml file with this servlet
information? Also, Beginning JSP Web Development states on page 299 that
you can define the default session timeout in the web.xml file when
executing your application under Tomcat. Will that work on the internet
too?
The example they give is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<webapp>
<session-config>
<session-timeout>-1</session-timeout>
</session-config>
</webapp>
Robin
Message #2 by "Ben Galbraith" <junk@g...> on Sat, 8 Feb 2003 08:05:54
|
|
Hello again Robin!
Your first question is: "When placing the project on a server (not
Tomcat), is it necessary to populate the web.xml file with this servlet
information?"
One of the advantages to creating J2EE web applications is that they follow
a standard configuration that can be deployed onto any J2EE "servlet
container". Part of this standard configuration dictates that web.xml
controls the mapping of incoming requests to servlets.
As you have discovered, some servlet containers, such as Tomcat, provide
supplement functionality above and beyond what the J2EE Servlet
specification dictates for web applications (e.g., the Invoker servlet).
However, if you use these mechanisms, you should be aware that they are not
portable. So, you must indeed use web.xml to configure your web
application if you want to move your web application to another servlet
container with zero configuration. Otherwise, you risk having to spend
quite a bit of administraiton and perhaps even additional coding to get
your web app to work with a different solution.
If you're confused as to what exactly are standard J2EE web application
features, perhaps the best place to turn is java.sun.com and review the
documentation in the servlet section.
Your second questions is: "Beginning JSP Web Development states on page 299
that you can define the default session timeout in the web.xml file when
executing your application under Tomcat. Will that work on the internet
too?"
I don't understand what you're asking here, but I'll take a shot at an
explanation. A session in terms of a J2EE web application is data that is
stored by a JSP or Servlet that is automatically associated with a web
browser by the servlet container. Because the web is stateless, the
servlet container has no way of (reliably) knowing when web users have
"stopped" using a web application. Because simply holding on to the data
forever would eventually consume all your server's resources, the data must
be erased at some point. The session timeout controls the amount of time
(in minutes) that must elapse since the web user's last request before the
servlet container can expunge session data.
So, if the servlet container (e.g. Tomcat) is functioning as a server on
the Internet (a task it was designed to do) then yes, the session timeout
"works on the Internet".
In the example you give, setting the session timeout to a value less than
0, the servlet container is configured to never expire the session data,
which is fine for some situations but very scalable (that is, if a lot of
folks start using your web app, and/or you store a lot of info in the
session, you're going to run out of resources quickly).
Hope these answers help!
Ben
|
|
 |