Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP 404 error problem

 
Ramesh Jambulingam
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What errors do you get in server log files ??
 
Ramesh Jambulingam
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What URL are you using to access the servlet?
 
Ramesh Jambulingam
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is only the context path - what about the name of the servlet, or the name of the JSP ??
 
Ramesh Jambulingam
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rene,

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

Thanks and Regards,
Ramesh.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic