You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Johnson, Garrett" <Jo...@cbsnews.com> on 2002/12/09 18:19:44 UTC

RE: Cannot Run Servlets, only JSP's, Part II (Attn: Mark)

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" <Jo...@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:
<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: Cannot Run Servlets, only JSP's, Part II (Attn: Mark)

Posted by Mark Eggers <it...@yahoo.com>.
Sorry - I was out for a bit and was a bit generic.

You need to modify the one in your application:

$CATALINA_HOME/webapps/myapp/WEB-INF/

There's more information about a web application at:

http://localhost:8080/tomcat-docs/appdev/index.html

provided you installed the documentation with Tomcat.

/mde/

just my two cents . . . .

--- "Johnson, Garrett" <Jo...@cbsnews.com> wrote:
> 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?

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

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>