This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes HTTP Status 404 - /myapps/helloworldservlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Status 404 - /myapps/helloworldservlet" Watch "HTTP Status 404 - /myapps/helloworldservlet" New topic
Author

HTTP Status 404 - /myapps/helloworldservlet

chandu boyapati
Greenhorn

Joined: Nov 01, 2008
Posts: 7
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

Joined: Oct 19, 2008
Posts: 33
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.??


Vijay
chandu boyapati
Greenhorn

Joined: Nov 01, 2008
Posts: 7
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

Joined: Jan 28, 2003
Posts: 4167
    
  21

> $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.


Steve
chandu boyapati
Greenhorn

Joined: Nov 01, 2008
Posts: 7
Thanks man...

As you said I misplaced the web.xml

Now it's working
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 818

web.xml should be placed under the WEB-INF directory and not inside the package1.


Regards, Sud.
SCJP 5 ScjpFAQ JLS
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 404 - /myapps/helloworldservlet
 
Similar Threads
HTTP Status 404 error in tomcat
applet and servlet not communicating... any ideas?
Web.XMl in JSP
HTTP Status 404 - /ch1/Serv1/
Http 404 Error