This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
This is a repeat question. If you have seen my posting in servlets board pls ignore it. I am just desparate to get an answer and thought this would be a good place to post too.
I remember to have done this exercise before on my computer and gotten the result page, but for some reason it is not working now. Compilation works fine since I put the servlet-api.jar file in the classpath. But when I launch the browser there is this message: "The requested resource (/ch1/Serv1) not available"
My logs directory does not have any error messages and is empty.
Thanks Harish, I did find my mistake. I saw the web.xml file listed when I typed: http://localhost:8000/ch1 When I clicked on it, the page showed an error message and I figured I misspelt the closing </servlet-mapping> tag.
But even though I corrected the web.xml file, saved in both working and tomcat directory, shutdown and restarted the server and the system, I have the same problem and clicking on the web.xml link on the browser still shows the same mismatched closing tag error message.
One more thing I now noticed in the tomcat server window is this:
INFO: Missing application web.xml, using defaults only StandardEngine[Catalina].StandardHost[LocalHost].StandardContext[/ch1]
Where did I go wrong? Why does it not recognize my web.xml? [ January 18, 2006: Message edited by: Sue Pillai ]
Sue, I had the same error before. If you are sure you've got all errors corrected in web.xml(that error you got, quite likely there is something wrong with the web.xml file), try pack your files in a war file and use Tomcat's manager to deploy it. At least it solved my problem. Drop the corrected web.xml file did not work for me. Besides, what is your context.xml look like?
-Ben<br />SCJP/SCJD 1.4<br />Certified Sybase DBA
Joined: Nov 04, 2004
Originally posted by Ben Weng: Sue, I had the same error before. If you are sure you've got all errors corrected in web.xml(that error you got, quite likely there is something wrong with the web.xml file), try pack your files in a war file and use Tomcat's manager to deploy it. At least it solved my problem. Drop the corrected web.xml file did not work for me. Besides, what is your context.xml look like?
Ben, I dropped the whole example and recreated it this time with different names and deployed it. positively no errors in the DD this time. Still the same error while executing! Since I am still in the first chapter, I have no clue of how to pack my files to a war or deploy in the tomcat's manager. I also did not know what the context.xml does, but I did give a search in the tomcat directory and got 2 of them. One in the conf directory and one in webapps/balancer/meta-inf directory. I have listed the contents for you.
The first one is as follows:
<!-- The contents of this file will be loaded for each web application --> <Context>
<!-- Default set of monitored resources --> <WatchedResource>WEB-INF/web.xml</WatchedResource> <WatchedResource>META-INF/context.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts --> <!-- <Manager pathname="" /> -->
The second one is:
Context configuration file for the Tomcat Balancer Web App This is only needed to keep the distribution small and avoid duplicating commons libraries
Extremely sorry Ben, Harish & Meenakshi....I think I am becoming an extreme case of ADD.
It was a stupid stupid mistake on my part. I put the web.xml in the wrong directory, (directly under ch1, instead of ch1/web-inf) and I am looking at writing the exam in a month!
Really sorry for wasting your time.
Joined: Feb 22, 2005
Oh well. I am just happy for you that you figured it out -- which by the way, probably the hardest problem to troubleshoot.
Joined: Sep 15, 2004
no problem. We all went through those problems.
Joined: Oct 07, 2005
I know how that feels i was stuck with that example for 3 days...once you get that done it will be easier to get the rest done so dont worry, put ur mind to it you will be ready for the exam in a month