You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mark <ma...@bellsouth.net> on 2001/11/21 21:42:58 UTC

TC 4.0 newbie - servlet app won't run

I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the
example servlets, but not my own.  My html displays and I can execute my
JSPs, but a POST to a servlet does not work (this app has run under Forte
and VA Java in the past).   I get a 404 error with "the requested resource
(/myservlet) is not available". Since the examples work, I have to assume
it's something in my configuration. Any help figuring out why the servlet
won't run would be *greatly* appreciated.  I suspect it's something
simple/braindead on my part.


o  My directory structure for the app:
   TomcatHome
        |
        +--webapps
              |
              +--myapp\.jsp, .html .gif
                 |
                 +--WEB-INF\web.xml
                       |
                       +--classes\.class files


o  My html POST stmt. I've tried various path prefixes to myservlet, eg      
   "classes/myservlet".  As with the Tomcat examples, this servlet has no
   package:

    <FORM ACTION="/myservlet" method="POST">


o  My web.xml - I know Tomcat's seeing/parsing this because if I deliberately
   make a typo I get an error upon startup:

     <?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/dtd/web-app_2_3.dtd">
    <web-app>
       <!-- Define servlets that are included in the application -->
       <servlet>
           <servlet-name>myservlet</servlet-name>
           <servlet-class>myservlet</servlet-class>
       </servlet>   
       <servlet-mapping>
           <servlet-name>myservlet</servlet-name>
           <url-pattern>/classes</url-pattern>
       </servlet-mapping>
    </web-app>


o  Update to server.xml 

   <Context path="/myapp" docBase="myapp" debug="0">
       <Logger className="org.apache.catalina.logger.FileLogger"
               prefix="myapp_log." suffix=".txt"
               timestamp="true"/>
   </Context>




                    



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: TC 4.0 newbie - servlet app won't run

Posted by Galbayar <ga...@mobicom.mn>.
<FORM ACTION="servlet/myservlet" method="POST">


----- Original Message -----
From: "Mark" <ma...@bellsouth.net>
To: <to...@jakarta.apache.org>
Sent: Thursday, November 22, 2001 04:42
Subject: TC 4.0 newbie - servlet app won't run


> I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the
> example servlets, but not my own.  My html displays and I can execute my
> JSPs, but a POST to a servlet does not work (this app has run under Forte
> and VA Java in the past).   I get a 404 error with "the requested resource
> (/myservlet) is not available". Since the examples work, I have to assume
> it's something in my configuration. Any help figuring out why the servlet
> won't run would be *greatly* appreciated.  I suspect it's something
> simple/braindead on my part.
>
>
> o  My directory structure for the app:
>    TomcatHome
>         |
>         +--webapps
>               |
>               +--myapp\.jsp, .html .gif
>                  |
>                  +--WEB-INF\web.xml
>                        |
>                        +--classes\.class files
>
>
> o  My html POST stmt. I've tried various path prefixes to myservlet, eg
>    "classes/myservlet".  As with the Tomcat examples, this servlet has no
>    package:
>
>     <FORM ACTION="/myservlet" method="POST">
>
>
> o  My web.xml - I know Tomcat's seeing/parsing this because if I
deliberately
>    make a typo I get an error upon startup:
>
>      <?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/dtd/web-app_2_3.dtd">
>     <web-app>
>        <!-- Define servlets that are included in the application -->
>        <servlet>
>            <servlet-name>myservlet</servlet-name>
>            <servlet-class>myservlet</servlet-class>
>        </servlet>
>        <servlet-mapping>
>            <servlet-name>myservlet</servlet-name>
>            <url-pattern>/classes</url-pattern>
>        </servlet-mapping>
>     </web-app>
>
>
> o  Update to server.xml
>
>    <Context path="/myapp" docBase="myapp" debug="0">
>        <Logger className="org.apache.catalina.logger.FileLogger"
>                prefix="myapp_log." suffix=".txt"
>                timestamp="true"/>
>    </Context>
>
>
>
>
>
>
>
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


RE: TC 4.0 newbie - servlet app won't run

Posted by Wouter Boers <wo...@ikke.net>.
I think your problem might be this:
       <servlet-mapping>
           <servlet-name>myservlet</servlet-name>
           <url-pattern>/classes</url-pattern>
       </servlet-mapping>

AFAIK the url-pattern should be:
<url-pattern>/myservlet</url-pattern> to map http://..../myapp/myserlvet to
you servlet 'myservlet' which is associated with the myservlet class

Wouter

-----Original Message-----
From: Mark [mailto:markd@bellsouth.net]
Sent: 21 November 2001 21:43
To: tomcat-user@jakarta.apache.org
Subject: TC 4.0 newbie - servlet app won't run


I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the
example servlets, but not my own.  My html displays and I can execute my
JSPs, but a POST to a servlet does not work (this app has run under Forte
and VA Java in the past).   I get a 404 error with "the requested resource
(/myservlet) is not available". Since the examples work, I have to assume
it's something in my configuration. Any help figuring out why the servlet
won't run would be *greatly* appreciated.  I suspect it's something
simple/braindead on my part.


o  My directory structure for the app:
   TomcatHome
        |
        +--webapps
              |
              +--myapp\.jsp, .html .gif
                 |
                 +--WEB-INF\web.xml
                       |
                       +--classes\.class files


o  My html POST stmt. I've tried various path prefixes to myservlet, eg
   "classes/myservlet".  As with the Tomcat examples, this servlet has no
   package:

    <FORM ACTION="/myservlet" method="POST">


o  My web.xml - I know Tomcat's seeing/parsing this because if I
deliberately
   make a typo I get an error upon startup:

     <?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/dtd/web-app_2_3.dtd">
    <web-app>
       <!-- Define servlets that are included in the application -->
       <servlet>
           <servlet-name>myservlet</servlet-name>
           <servlet-class>myservlet</servlet-class>
       </servlet>
       <servlet-mapping>
           <servlet-name>myservlet</servlet-name>
           <url-pattern>/classes</url-pattern>
       </servlet-mapping>
    </web-app>


o  Update to server.xml

   <Context path="/myapp" docBase="myapp" debug="0">
       <Logger className="org.apache.catalina.logger.FileLogger"
               prefix="myapp_log." suffix=".txt"
               timestamp="true"/>
   </Context>








--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>




--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>