tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnson, Garrett" <Johns...@cbsnews.com>
Subject RE: Cannot Run Servlets, only JSP's, Part II (Attn: Mark)
Date Mon, 09 Dec 2002 17:19:44 GMT
Mark,

Thank you, that sounds like exactly what it could be.  And I'd prefer to do
it the RIGHT way, explicitly mapping out each servlet.

Just one question:  WHICH web.xml file?  There's one in:

$CATALINA_HOME/conf/

and one in 

$CATALINA_HOME/webapps/myapp/WEB-INF/

Will one override the other?

-----Original Message-----
From: Mark Eggers [mailto:its_toasted@yahoo.com]
Sent: Monday, December 09, 2002 12:12 PM
To: Tomcat Users List
Subject: RE: Cannot Run Servlets, only JSP's, Part II


The invoker servlet is commented out by default in
4.1x.  Anonymous servlets are considered a security
risk.

There are at least three ways to manage this problem.

1. Uncomment the following in your Tomcat's web.xml
file.

    <!-- The mapping for the invoker servlet -->
    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>

This maps the invoker servlet and allows anonymous
servlets in your application.  Read the documentation
concerning the security issues, and also know that
this is a nonstandard feature of Tomcat.

2. Use the invoker servlet only in your web
application.  This has the same ramifications as the
first solution, but constrained to a single
application.  Add the following to your
/<app-name>/WEB-INF/web.xml

<!-- for anonymous servlets -->
    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>

3. Add each and every servlet to the web.xml file,
complete with a URL mapping.  This is the preferred
way.  Here is an example.

  <servlet>
    <servlet-name>example1</servlet-name>
    <display-name>example1</display-name>
    <servlet-class>myclasses.example1</servlet-class>
  </servlet>

    <servlet-mapping>
        <servlet-name>example1</servlet-name>
        <url-pattern>servlet/example1</url-pattern>
    </servlet-mapping>

/mde/

just my two cents . . . .

--- "Johnson, Garrett" <JohnsonG@cbsnews.com> wrote:
> Oh, yeah:  My system information:
> 
> Win2K, SP3
> Tomcat 4.1 listening on Port 8080

> I'm running through the O'Reilly (onjava.com)
> tutorial on deploying
> applications in Tomcat, and I can't seem to get
> servlets to work.  I render
> JSP's just fine, but once I request a servlet, I get
> a an HTTP Status 404
> error:
> 
> The requested resource
> (/onjava/servlet/com.onjava.login) is not available.


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message