• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 404 - /myapps/helloworldservlet

 
chandu boyapati
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello every one,

...I am unable to run simple servlet named "helloworldservlet"

...I created fallowing directory structure

$CATALINA_HOME/webapps/myapps
$CATALINA_HOME/webapps/myapps/WEB-INF/
$CATALINA_HOME/webapps/myapps/WEB-INF/lib
$CATALINA_HOME/webapps/myapps/WEB-INF/classes/
$CATALINA_HOME/webapps/myapps/WEB-INF/classes/package1/
$CATALINA_HOME/webapps/myapps/WEB-INF/classes/package1/helloworldservlet.class
$CATALINA_HOME/webapps/myapps/WEB-INF/classes/package1/web.xml

... web.xml :
--------
<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<servlet>
<servlet-name>helloworldservlet</servlet-name>
<servlet-class>package1.helloworldservlet</servlet-class>
<load-on-startup/>
</servlet>
<servlet-mapping>
<servlet-name>helloworldservlet</servlet-name>
<url-pattern>/helloworldservlet</url-pattern>
</servlet-mapping>
</web-app>

...I added below lines to $CATALINA_HOME/conf/server.xml

<Context path="/myapps"
docBase="myapps"
debug="0"
reloadable="true" >
</Context>

...I used below url for accessing the servlet

http://localhost:8080/myapps/helloworldservlet

...I got the below error

HTTP Status 404 - /myapps/helloworldservlet
type Status report
message /myapps/helloworldservlet
description The requested resource (/myapps/helloworldservlet) is not available.

...some one please help me
 
vijay kumar dahiya
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be Its probelem occur in web.xml.
Container are not able to findout desired servlet in servlet-mapping.
Check your web.xml file.servlet are proper mapped by the URL.??
 
chandu boyapati
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really appreciate your immediate reply.

yes ... there is a problem some where in the web.xml or in server.xml while
specifying the Context.

I did my level best to identify the error.But I am unable to find the error.

Can you please check the web.xml and server.xml contents (which I provided) and suggest is that is the right way to specify the directories.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> $CATALINA_HOME/webapps/myapps/WEB-INF/classes/package1/web.xml

This is the first place to look. The web.xml should be in the WEB-INF directory, not a package under the WEB-INF/classes directory.
 
chandu boyapati
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks man...

As you said I misplaced the web.xml

Now it's working
 
sudipto shekhar
Ranch Hand
Posts: 826
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
web.xml should be placed under the WEB-INF directory and not inside the package1.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic