wood burning stoves 2.0*
The moose likes Tomcat and the fly likes HTTP Status 404 problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "HTTP Status 404 problem" Watch "HTTP Status 404 problem" New topic
Author

HTTP Status 404 problem

thirun pavan
Greenhorn

Joined: Jun 27, 2007
Posts: 22
Hi All,

I have Tomcat6 installed under Ubuntu 10 and I am trying to run my first form under tomcat, although every time I try to run the form I get error:

HTTP Status 404 - /Beer-v1/form.html

I've tried almost everything, starting from checking the spelling / case of URL and up to revising code inside the form and I don't seem to understand what's wrong so can someone please help me and tell me what I might be doing wrong here?

form.html code:



web.xml content:



Directory structure under /usr/share/tomcat6/webapps/Beer-v1/
-form.html
- WEB-INF (folder)
----web.xml


Note: I've revised Tomcat log files and saw nothing special to describe the error

Thanks in advance for your time and efforts
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Try put Beer-v1 - which is your web application context - in front of SelectBeer.do in the form action url...

Like this:


Regards, Rene Larsen
Dropbox Invite
thirun pavan
Greenhorn

Joined: Jun 27, 2007
Posts: 22
Hi Rene,

Thanks a lot for your time and help....Regarding the form URLI Tried it before and it didn't work

I think it is something related to the web.xml file, as I have revised the html code many times and tried to tweak it.........and didn't reach anything...

Any ideas?

Thanks in advance for your time
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

I've now tested the code you have posted - and it is in web.xml the error is...

If you look in TOMCAT/log/catalina.out you will see this Exception thrown

The error is that you are missing a space between the xsi:schemaLocation and version attribute

should be
thirun pavan
Greenhorn

Joined: Jun 27, 2007
Posts: 22
Thanks a lot Rene for your time and help, after extensive research I have found reasons behind the problem as follows:

1. I was putting my files under /usr/share/tomcat6/ while they should have been placed under /var/lib/tomcat6/
I couldn't find any documentation what so ever to explain this, except one blog post for how to install Tomcat under Ubuntu!

2. Changing the xml files from (web.xml) to (context.xml)....I really don't understand why the name of the file must be context.xml especially that I saw many applications/ examples with their xml files as web.xml, but the form simply didn't get displayed unless if the file name is changed to context.xml

3. Fixing the internal error in the xml file which you have pointed out in your last message

Without the above 3 steps, the form will never get displayed....Ironically when I tried to click submit on the form, now I get a new 404 message as follows:

HTTP Status 404 - /Beer-v1/SelectBeer.do

type Status report

message /Beer-v1/SelectBeer.do

description The requested resource (/Beer-v1/SelectBeer.do) is not available.
Apache Tomcat/6.0.24



So any idea what I might be doing wrong here?

Thanks in advance for your time
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

What errors do you get in TOMCAT/logs/catalina.out ??

Is your web application deployed ?? (see TOMCAT/logs/catalina.out)
thirun pavan
Greenhorn

Joined: Jun 27, 2007
Posts: 22
Here is the exact log file content when I try to hit submit



It is not an 'application' as you might think, it is just a single class where I am trying servlets, JSP and forms

I didn't see anything strange in the log file except the first line which I don't understand quite well....so any ideas?

Thanks in advance for your time and efforts
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You have lost me - sorry

If I understand you correct, you have changed "Beer-v1/WEB-INF/web.xml" -> "Beer-v1/WEB-INF/context.xml" - is that correct ??

This is not a valid web application - and therefore I think your Servlet is not deployed at all (but you should have gotten an error in the log file)

A context.xml need to be put in "TOMCAT/conf/[enginename]/[hostname]/context.xml - and then you can do some additional configuration to your web application (WAR).

With a context.xml you can e.g. deploy a WAR - without having it in the TOMCAT/webapps

The structure of a WAR is (always):
thirun pavan
Greenhorn

Joined: Jun 27, 2007
Posts: 22
Thanks a lot Rene for your continuous help and support...highly appreciated

Finally I've found what's wrong ...it seems that all what was wrong is the web.xml file content...I searched for web application examples on the web, took the web.xml from one of those applications and just updated its content with my sample application content and that was it, the application worked
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 404 problem
 
Similar Threads
Headfirst ch3 Beerselect submit button not working
Tomcat 5.5 - application development
Getting problem with post method
MVC tutorial Head First
Problems with the Example from HF Servlets & JSP in Chapter 3