• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

HTTP Status 404 problem

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try put Beer-v1 - which is your web application context - in front of SelectBeer.do in the form action url...

Like this:
 
thirun pavan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What errors do you get in TOMCAT/logs/catalina.out ??

Is your web application deployed ?? (see TOMCAT/logs/catalina.out)
 
thirun pavan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic