Can you remind me how to do that (or where to find documentation describing it)?

FileUploadServlet is one that I wrote some time back and it has a web.xml file associated with it. I'm pretty sure I created it myself although I don't actually remember doing so at this point. Here are the current contents but I'm not sure if this is still how the web.xml should look at this point:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>

<web-app>

   <servlet>
       <servlet-name>form</servlet-name>
       <servlet-class>upload.UploadForm</servlet-class>
   </servlet>
   <servlet>
       <servlet-name>servlet</servlet-name>
       <servlet-class>upload.UploadServlet</servlet-class>
   <init-param>
       <param-name>uploadDir</param-name>
       <param-value>uploads</param-value>
   </init-param>
   </servlet>

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

</web-app>

Also, does this file need to be put into Tomcat somehow so that Tomcat can see it? If so, what is the proper mechanism to do so? Or does the act of exporting to the war file do that automagically? Again, my memory is really fuzzy on this stuff and I don't remember where these techniques are described.

--
Rhino

Joseph M Morgan wrote:
Did you configure your servlets in your web.xml properly? Also...it sounds as though you are deploying each servlet in its own app. Make sure you are invoking the servlet through the proper app.

-----Original message-----
From: Rhino <rhi...@sympatico.ca>
To: tomcat-user <tomcat-u...@jakarta.apache.org>
Sent: Fri, Apr 16, 2010 01:07:29 GMT+00:00
Subject: Basic Question

I hope someone will take pity on me and help me with this very basic question. I was moderately fluent with servlets and Tomcat several years ago but haven't touched them in a while. I'm trying to get back into servlets now.

I am having trouble getting my servlets to start in Tomcat. I inevitably get a 404 error. I am running Tomcat 6.0.26 on Windows XP SP2. The sample applications in Tomcat run fine.

My servlets are in Eclipse 3.5.2. They compile fine and I have used the Tomcat menu to export them to the war file directory; no error gets reported when I do the export. I did a manual deploy of the war file from the "war file to deplay section of the Tomcat Manager page.

When I start the Tomcat Manager in my browser, it shows several servlets, including the examples and the servlets that I have deployed myself. In each case, my own servlets seem to be started just fine. All of them say "running", the number of sessions is 0 for each of them, and all of them have stop, reload and undeploy options which are clickable and a start option which is not clickable. To me, that says these puppies are started and there is no error in any of them.

However, when I click on my servlets, like /FileUploadServlet for example, I get this:


 HTTP Status 404 - /FileUploadServlet/

------------------------------------------------------------------------

*type* Status report

*message* _/FileUploadServlet/_

*description* _The requested resource (/FileUploadServlet/) is not available._

------------------------------------------------------------------------


     Apache Tomcat/6.0.26



I feel sure that I've simply neglected to do something simple and straightforward but my memory is failing me. I can't remember what other steps are needed to get a servlet configured so that it runs in Tomcat.

I was going to try to run the servlet in Eclipse but I'm darned if I can remember how to start it there either.

Can someone help me out?

--
Rhino

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to