Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 14th, 2014, 07:31 PM
Registered User
 
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!





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.