Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Small Tomcat configuration problem

 
Jacob Thomas
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have installed Apache Tomcat/5.5.15 on my machine. Followed the installation steps detailed on www.coreservlets.com site. Got it up and running. I am able to see the homepage of the Tomcat server. Also, I am able to run all the example servlets and jsps in the webapps directory.

However, when I try to create and access the sample Beer web application given in chapter 3 of Head First Servlets and JSP book, I get a 404 Error. As detailed in the book, I have created the Beer-v1 directory under webapps directory. But this application works if I move the folder to servlet-examples and access it using the following URL:

http://localhost:9090/servlets-examples/Beer-v1/form.html

Could anybody please reason this strange behaviour? Thanks!

PS: I have configured the Tomcat server to be running on port 9090
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you have placed your Beer-v1 directory in webapps, then by what url you have accessed it?

Naseem
[ July 27, 2006: Message edited by: Naseem Khan ]
 
Jacob Thomas
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I accessed it using this URL:


http://localhost:9090/Beer-v1/form.html


I guess it's correct.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order for Tomcat to treat a directory under webapps as a webapp, it must contain a WEB-INF directory.

Create that directory, then restart Tomcat, and retry.
 
Jacob Thomas
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much Ben. It did the trick!!! I was trying out the example in Head First Servelts and JSP book. I didn't create the entire folder structure before trying out the static html page. I created the WEB-INF folder as you said and it worked!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic