File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes error 404 requested resource not found in Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "error 404 requested resource not found in Eclipse " Watch "error 404 requested resource not found in Eclipse " New topic
Author

error 404 requested resource not found in Eclipse

Sagar Dafle
Greenhorn

Joined: Nov 06, 2012
Posts: 18
Hi guys, I have a simple hello.jsp file in my "HelloWorld" project.
But when i am running it i am getting ERROR 404.

But a simple .java file(from another project) is running properly ....


Here's my hello.jsp file :

"<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Hello World</title>
</head>
<body>
Hello World!!
</body>
</html>"




here's my web.xml file :

"<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>HelloWorld</display-name>
<welcome-file-list>
<welcome-file>hello.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>"


Configurations are done properly ...

Please help out.....
i am newbie to Programming world....
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Hello Sagar Dafle ,

Can you please specify what URL are you typing in the browser to access the JSP ? The URL should be of the format http://localhost:8080/<project_context>/<web_page_dir>/hello.jsp

The project_context is most probably the name of your project and the web_page_dir is the directory where you are making the JSP files. If the JSP are made inside the WebContent ( or webapp ) folder directly then just omit this entry and the URL will be http://localhost:8080/<project_context>/hello.jsp .

Also do specify the project hierarchy that you have made. It will help us determine what is your project structure and how to access the JSP from browser .


Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
Niraj Jha
Ranch Hand

Joined: Feb 20, 2013
Posts: 63

Can you share your application directory structure?
Sagar Dafle
Greenhorn

Joined: Nov 06, 2012
Posts: 18
Thanxx for the concern and quick reply ASIF and NIRAJ

i have attached my project hierarchy and the error page ....... with both http://localhost:8080/HelloWorld/hello.jsp and http://localhost:8080/HelloWorld/WEB-INF/hello.jsp urls, i am getting the same error....






[Thumbnail for error 404.JPG]

Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

I found your mistake . You are directly attempting to access a JSP resources inside the WEB-INF directory. You can not do that. Anything inside the WEB-INF is protected from direct access. So to access your JSP page , just simply move it outside the WEB-INF folder to the WebContent . WebContent is your root folder and any JSP resource can be directly accessed from here. Once you have moved out the JSP , just hit the URL http://localhost:8080/HelloWorld/hello.jsp and it will work fine.
Sagar Dafle
Greenhorn

Joined: Nov 06, 2012
Posts: 18
:') :'( :'( :')


THANKS A TONNNNNNN SAIF !!!
now i am able to run it successfully !

i have been struggling with such a silly mistake from yesterday !!

GOD BLESS you saif and niraj .......
Keep helping people
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Your welcome :-)
nishant dahiya
Greenhorn

Joined: Aug 19, 2009
Posts: 15
Hi Saif,
I am facing the same problem as above and my program is almost similar. Also my helloWorld.jsp file is inside Web-content and not web-inf. Still i am getting the error that resource not found. All my tomcat connections are fine because it shows tomcat welcome page when i go to localhost. I am new to this and have been struggling to this for last 3-4 hours. I would appreciate any help.

PS: Attached are the screenshots.

Thanks,
Nishant.


[Thumbnail for snap3.PNG]

[snap2.PNG]

[Thumbnail for snap.PNG]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error 404 requested resource not found in Eclipse
 
Similar Threads
org.springframework.web.servlet.DispatcherServlet noHandlerFound
Not able to evaluate Expression Language
Struts2: Simple example-Action not getting invoked; status 404
problem in Struts2 while running an application
STRUTS example not running