Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Struts - A MVC web framework
Tomcat - JSP/Servlet container
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
JSP - A mailing list about Java Server Pages specification and reference
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Why can 't run Sevlet in Tomcat5

Why can 't run Sevlet in Tomcat5

2003-09-19       - By Edward King

 Back
Reply:     1     2     3  

I have a servlet file,like follows:

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class a1 extends HttpServlet{
   public void doGet(HttpServletResponse req,HttpServletResponse resp) throws
ServletException,IOException{
       PrintWriter pw=resp.getWriter();
       pw.println("<html><body>Hello World!</body></html>");
       pw.close();
   }
}

and web.xml is follows:
<?xml version="1.0" encoding="ISO-8859 (See http://ISO-8859.ora-code.com)-1"?>

<!DOCTYPE web-app
   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
  <servlet>
  <servlet-name>a1</servlet-name>
  <servlet-class>a1</servlet-class>
  </servlet>
</web-app>

I use Tomcat5.0,I don't want to use Tomcat5 default path ,so I put a1.class
into \Tomcat 5.0\webapps\test\WEB-INF\classes,and I have added a sentence into
server.xml,like follows:

<Context path="test" docBase="test" debug="0"/>

but when I run it in IE6,like follows:
http://localhost:8080/test/servlets/a1

it raises HTTP Status 404 error,"The requested resource (/test/servlets/a1) is
not available."

Why? I have configure path! Please help.
Thanks in advance
Edward

__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
To unsubscribe, send email to listserv@(protected) and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1226" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2><FONT size=3>I have a servlet file,like
follows:</FONT></FONT></DIV>
<DIV><FONT size=2><FONT size=3><BR>import javax.servlet.*;<BR>import
javax.servlet.http.*;<BR>import java.io.*;<BR>public class a1 extends
HttpServlet{<BR>&nbsp;&nbsp;&nbsp; public void doGet(HttpServletResponse
req,HttpServletResponse resp) throws
ServletException,IOException{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
PrintWriter pw=resp.getWriter();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pw.println("&lt;html&gt;&lt;body&gt;Hello
World!&lt;/body&gt;&lt;/html&gt;");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;
pw.close();<BR>&nbsp;&nbsp;&nbsp; }<BR>}<BR><BR>and web.xml is
follows:<BR>&lt;?xml version="1.0"
encoding="ISO-8859 (See http://ISO-8859.ora-code.com)-1"?&gt;<BR><BR>&lt;!DOCTYPE web-app<BR>&nbsp;&nbsp;&nbsp;
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"<BR>&nbsp;&nbsp;&nbsp; "</FONT><A
href="http://java.sun.com/dtd/web-app_2_3.dtd"><FONT
size=3>http://java.sun.com/dtd/web-app_2_3.dtd</FONT></A><FONT
size=3>"&gt;<BR><BR>&lt;web-app&gt;<BR>&nbsp;&nbsp;
&lt;servlet&gt;<BR>&nbsp;&nbsp;
&lt;servlet-name&gt;a1&lt;/servlet-name&gt;<BR>&nbsp;&nbsp;
&lt;servlet-class&gt;a1&lt;/servlet-class&gt;<BR>&nbsp;&nbsp;
&lt;/servlet&gt;<BR>&lt;/web-app&gt;<BR><BR>I use Tomcat5.0,I don't want to use
Tomcat5 default path ,so I put a1.class into \Tomcat
5.0\webapps\test\WEB-INF\classes,and I have added a sentence into
server.xml,like follows:<BR><BR>&lt;Context path="test" docBase="test"
debug="0"/&gt;<BR><BR>but when I run it in IE6,like follows:<BR></FONT><A
href="http://localhost:8080/test/servlets/a1"><FONT
size=3>http://localhost:8080/test/servlets/a1</FONT></A><BR><BR><FONT size=3>it
raises HTTP Status 404 error,"The requested resource (/test/servlets/a1) is not
available."<BR><BR>Why? I have configure path! Please help.<BR>Thanks in
advance<BR>Edward</FONT><BR></DIV></FONT></BODY></HTML>
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
To unsubscribe, send email to listserv@(protected) and include in the body
of the message "signoff SERVLET-INTEREST".
<p>
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
<p>

©2008 junlu.com - Jax Systems, LLC, U.S.A.