• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Head First Sample Code

 
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am following the Head First Servlets and JSP for the exam.When i am trying to deploy a small MVC application (Chapter 3) in Tomcat, I am getting a resource not found error.

I have placed the form.html under both the deployment and development environment as specified in the text.Stll the form.html is not loaded.Please help

Thanks,
Anila Mathew
 
Ranch Hand
Posts: 229
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have a WEB-INF directory? I think you'll need that.
 
Anila Mathew
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, i have created a WEB_INF directory in D:\TomCat\webapps\DirectoryName
and also in D:\MyPrograms\DirectoryName\etc.
 
Edmund Yong
Ranch Hand
Posts: 229
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you accessing the page? Did you enter the URL correctly? Should be:

http://localhost:8080/DirectoryName/form.html
 
Anila Mathew
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, i am using the link http://localhost:8080/DirName/form.html. When i use http://localhost:8080, i am getting the tomcat home page
 
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Anila,

post your web.xml file here so we can all take a look on it.

Regards,
Darya
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The directory shd be WEB-INF and not WEB_INF.
 
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Anila,
I had also faced the similar problem many time. What i did was i created a copy of the existing directory under webapps and then renamed. It solved the problem for me. I guess i was having the problem because there was some mistake in my web.xml(but i could not figure out what, I hope the directory you are using is WEB-INF and not WEB_INF)

N C
 
Anila Mathew
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Honestly saying my web.xml is empty. I thought for just showing the html page it just need to have a text file named web.xml.

Can you tell what should be the content of the web.xml file?

Thanks all,
Anila
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You tried it with an empty web.xml . Are you ...

Here an example how your web.xml can look:


<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<servlet>
<servlet-name>Anila's Servlet</servlet-name>
<servlet-class>YOURServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Anila's Servlet</servlet-name>
<url-pattern>/Serv</url-pattern>
</servlet-mapping>
</web-app>



Regards,
Darya
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Yes, i have created a WEB_INF directory in D:\TomCat\webapps\DirectoryName
and also in D:\MyPrograms\DirectoryName\etc.



1. Is D:\TomCat\ your TomCat root directory?
2. If point 1 is correct, put form.html under d:\TomCat\webapps\DirectoryName.
3. Directory name should be WEB-INF, not WEB_INF.

Yes, i am using the link http://localhost:8080/DirName/form.html. When i use http://localhost:8080, i am getting the tomcat home page



You should use url http://localhost:8080/DirectoryName/form.html, not http://localhost:8080/DirName/form.html

You don't need web.xml to display form.html.
 
Anila Mathew
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dongshan Cai,

Thanks a lot.Even i got confused whether you need a web.xml file to display just an html page.

My tomcat installation is in D:\Tomcat\Tomcat5.0

I have corrected the WEB_INF to WEB-INF.

My application directory name is Dolls and html is Doll.html.

I have placed this Doll.html in D:MyPrograms\Dolls\Doll.html

and also in D:Tomcat\Tomcat5.0\webapps\Dolls\Doll.html

Also D:\Tomcat\Tomcat5.0\webapps\Dolls\WEB-INF directory also

Regards,
Anila
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. You need a web.xml to display a simplest html page ( I tried in Tomcat5.5). Without it, you will get "resource not found error".

Bests,

Jason
 
Cai DongShan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I removed web.xml and restart tomcat, then open the following page without problem.

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

I am using Tomcat 5.5.9 with J2SE 1.5.0_03-b07 on Windows XP.
 
Cai DongShan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anila,

Sorry for late reply. Have you solve the problem? Can you display the html page now?

Thanks a lot.Even i got confused whether you need a web.xml file to display just an html page.



You are welcome. I don't need web.xml file to display the html page. Please refer to my previous post.

My tomcat installation is in D:\Tomcat\Tomcat5.0

I have corrected the WEB_INF to WEB-INF.

My application directory name is Dolls and html is Doll.html.

I have placed this Doll.html in D:MyPrograms\Dolls\Doll.html

and also in D:Tomcat\Tomcat5.0\webapps\Dolls\Doll.html

Also D:\Tomcat\Tomcat5.0\webapps\Dolls\WEB-INF directory also



You can display Doll.html by using web page http://localhost:8080/Dolls/Doll.html
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic