This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Tomvat 5.5.11 having trouble finding Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomvat 5.5.11 having trouble finding Servlets" Watch "Tomvat 5.5.11 having trouble finding Servlets" New topic

Tomvat 5.5.11 having trouble finding Servlets

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Hi guys. I'm having a little trouble with Tomcat 5.5.11 and Servlets...

Basically I have a web based system which allows users to login and browse/upload/download images at will

I have created the basic JSPs and file structure
C:\Java\Tomcat 5.5\webapps\web
Java classes are under - C:\Java\Tomcat 5.5\webapps\web\WEB-INF\classes\uk\co\domain\...

Servlets are under a folder in here called [servlets]
C:\Java\Tomcat 5.5\webapps\web\WEB-INF\classes\uk\co\domain\servlets

I have written the LoginServlet and it is under the following above address and it works fine. But
I have a Servlet called UploadServlet for uploading images i the same folder, mapped in the web.xml (see below) and
called in the following form:

<form name="frmUploader" action="UploadServlet" method="POST">

Page just redirects to a 404 [The requested resource (/web/secure/dam/uploader/UploadServlet) is not available]

<servlet id="Servlet_1136308272594">
<servlet id="Servlet_1136308272595">

<servlet-mapping id="ServletMapping_1136308273704">
<servlet-mapping id="ServletMapping_1136308273705">

As I say, the LoginServket works fine so why would the be a problem with the UploadServlet?
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Did you look in your Tomcat logs for error messages?

What upload library are you using?
In order to upload files you need to set the enctype to multipart/form-data.

Is your upload library rejecting no-multipart requests?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Weng

Joined: Feb 22, 2005
Posts: 19
I don't think Secker had gone that for to the multi-part part. According to your description, Secker try giving the path as "/web", docBase as "web" in the Context.xml, something like this:
<Context path="/web" docBase="web" ...>
and calling the servlet this way:
<form name="yourformname" action="/web/UploadServlet" ...>

-Ben<br />SCJP/SCJD 1.4<br />Certified Sybase DBA
I agree. Here's the link:
subject: Tomvat 5.5.11 having trouble finding Servlets
It's not a secret anymore!