File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes HTTP 404 error problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "HTTP 404 error problem" Watch "HTTP 404 error problem" New topic
Author

HTTP 404 error problem

Ramesh Jambulingam
Greenhorn

Joined: Jun 25, 2010
Posts: 19
Hi,
I am developing a web application using servets and JSP, First trying to run a basic servlet program. But getting HTTP 404- Requested resource not found error. The war file is listed in

http://localhost:8080/jmx-console/

After guidence from forums, I changed the default context root path "/". Still error is able to be resolved. Can anyone suggest any solutions please...




Thanks and Regards,
Ramesh.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

What errors do you get in server log files ??


Regards, Rene Larsen
Dropbox Invite
Ramesh Jambulingam
Greenhorn

Joined: Jun 25, 2010
Posts: 19
Hi Rene,
Thanks for your reply. The console just shows, deployment message as

20:14:42,271 INFO [TomcatDeployer] deploy, ctxPath=/Servlet1, warUrl=file:/C:/Workplace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_4.2_Runtime_Server1278021570421/deploy/servletTest.war/

and getting 404 error in browser.. for your kind information I am using only Servlets and JSP(using only war file generation).

Thanks and Regards,
Ramesh.
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

What URL are you using to access the servlet?


SCJP, SCWCD.
|Asking Good Questions|
Ramesh Jambulingam
Greenhorn

Joined: Jun 25, 2010
Posts: 19
Hi Amit,

I am using http://localhost:8080/servletTest/ and also I tried with http://localhost:8080/Servlet1/

Thanks and Regards,
Ramesh.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

This is only the context path - what about the name of the servlet, or the name of the JSP ??
Ramesh Jambulingam
Greenhorn

Joined: Jun 25, 2010
Posts: 19
Hi Rene,

Servlet1.java is the name of the servlet.

I am giving my web.xml details for your reference,

<?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>servletTest</display-name>
<welcome-file-list>
<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>
<servlet>
<description></description>
<display-name>Servlet1</display-name>
<servlet-name>Servlet1</servlet-name>
<servlet-class>servlet.Servlet1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Servlet1</servlet-name>
<url-pattern>/Servlet1</url-pattern>
</servlet-mapping>
</web-app>


Thanks and Regards,
Ramesh.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You wrote that ctxPath=/Servlet1 - meaning context path = Servlet1, and then the servlet mapping is /Servlet1

This should give the following URL: http://localhost:8080/Servlet1/Servlet1
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

I think you also have a WEB-INF/jboss-web.xml file in which you have set the context root ?? otherwise the context automatically would have been 'servletTest' (the name of the WAR)
Ramesh Jambulingam
Greenhorn

Joined: Jun 25, 2010
Posts: 19
Hi Rene,

Yes it works, the error is resolved. Thank you so much for your timely help..

Thanks and Regards,
Ramesh.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HTTP 404 error problem
 
Similar Threads
How do i correct this error
Filter not triggerring for applications outside webapps
creating user accounts
Url to app server
Handling response.redirect errors in JSP page