Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 14th, 2014, 07:31 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default HTTP Status 404-/

Hi,

I installed CentOS 6.5 and include both java devel and Tomcat packages during the installation. Trying to test that tomcat is working, I compiled the following:

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Test extends HttpServlet{

public void doGe(HttpServletRequest request, HttpServletResponse response)
throws IOException{
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<h1>Hello Servlet Get</h1>");
out.println("</body>");
out.println("</html>");
}
}

and moved the .class under /var/lib/tomcat6/webapps/ROOT/WEB-INF/classes

I save the following web.xml under /var/lib/tomcat6/webapps/ROOT/WEB-INF

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<servlet>
<servlet-name>Servlet Name For Demo1</servlet-name>
<servlet-class>Test</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Servlet Name For Demo1</servlet-name>
<url-pattern>/Demo1</url-pattern>
</servlet-mapping>
</web-app>

I then started both httpd and tomcat6, started firefox and typed 127.0.0.1:8080 and got:

HTTP Status 404-/
type status report
message /
description The requested resource (/) is not available
Apache Tomcat/6.0.24

When I tried 127.0.0.1:8080/Test, I got:

HTTP Status 404-/Test
type status report
message /Test
description The requested resource (/Test) is not available
Apache Tomcat/6.0.24

I'm starting to learn servlets and would appreciate your help!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP STATUS 404 ERROR TOMCAT rahul4u1861 Servlets 1 February 15th, 2012 01:05 AM
HTTP Status 404 - /TomcatProject/JSPDemo.jsp = ERROR gk03 Servlets 1 October 5th, 2009 01:15 AM
HTTP Status 404 rivcam JSP Basics 7 June 3rd, 2008 09:32 PM
HTTP status 404-Servlet action is not available matrixbegins Struts 0 October 24th, 2007 11:09 PM
HTTP status 404 brianjs JSP Basics 2 October 26th, 2003 03:06 PM



All times are GMT -4. The time now is 10:09 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.