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

Http Status 404

 
praveen kumar t
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I have installed tomcat version 7 and i'm able to access the homepage by specifying http://localhost:8080 in the browser
But when i try to access the html which i have created in my webapp, i'm getting the following error
HTTP Status 404 - /TestServlet/myIndex.html

type Status report

message /TestServlet/myIndex.html

description The requested resource (/TestServlet/myIndex.html) is not available.

Apache Tomcat/7.0.26

TestServlet is the name of the app

what could have gone wrong ???
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The most likely cause is that Tomcat does not recognize the TestServlet directory as a webapp because the directory structure is not correct.

Look at the directory structure under ROOT or the examples webapp for clues.

Be sure that the directory named WEB-INF is all caps and that it contains a web.xml deployment descriptor.

Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the ServletsFaq. This is addressed with the very first entry.
 
praveen kumar t
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:The most likely cause is that Tomcat does not recognize the TestServlet directory as a webapp because the directory structure is not correct.

Look at the directory structure under ROOT or the examples webapp for clues.

Be sure that the directory named WEB-INF is all caps and that it contains a web.xml deployment descriptor.

Bill


Thanks for Reply Bill

I have created the directory structure From eclipse IDE as new ->dynamic web project

Following is the directory structure
TestServlet
src
FirstServlet.java
WebContent
index.html
input.html
WEB-INF
web.xml

The server is up and running wnen started from IDE and i'm able to access index.html and map it to input.html
where I enter some text and submit .
And the form action="/FirstServlet" which should map to servlet where i'm accessing the form data using getParameter is not running.
I'm getting the
HTTP Status 404 - /FirstServlet

type Status report

message /FirstServlet

description The requested resource (/FirstServlet) is not available.

error..

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read the FAQ entry and made sure that you've done each item listed there?
 
praveen kumar t
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Have you read the FAQ entry and made sure that you've done each item listed there?


Yes i have.
And i'm able to run the app in IDE now, trying to run it in browser.
 
Vicky Rajawat
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It could've something to do with DD infact I think it has. Check the <web-app x x x> tag. Someone had the same problem, I think it has something to do with little change. I mean the tag you are using probably would've been valid earlier. So change x x and x accordingly
 
abhishek jethwani
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if its working in IDE but not in explorer then it could be directory path issue.

you can check with another option create war file deploy it on server directly and check if hows its responding.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic