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.
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?
Directory structure under /usr/share/tomcat6/webapps/Beer-v1/
- WEB-INF (folder)
Note: I've revised Tomcat log files and saw nothing special to describe the error
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
Joined: Jun 27, 2007
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
description The requested resource (/Beer-v1/SelectBeer.do) is not available.
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):
Joined: Jun 27, 2007
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