我的TOMCAT的安装目录为D:\program files\Apache Software Foundation\Tomcat 6.0
classpath为CLASSPATH=D:\program files\Java\jdk1.6.0_03\lib\tools.jar;d:\a;D:\program files\Apache
 Software Foundation\Tomcat 6.0\lib\servlet-api.jar
classpath的设置应该是没有问题呀。
我编译好了一个类HelloServlet.class并将其放在
D:\program files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT\WEB-INF\classes
目录下,
TOMCAT服务器出于开启状态,
我在浏览器中打开http://localhost:8080/server/HelloServlet
确得到一个错误如下:
(端口8080是对的)HTTP Status 404 - /servlet/HelloServlet--------------------------------------------------------------------------------type Status reportmessage /servlet/HelloServletdescription The requested resource (/servlet/HelloServlet) is not available.
--------------------------------------------------------------------------------Apache Tomcat/6.0.13
请各位高手解惑!小弟先谢过!

解决方案 »

  1.   

    可能是因为没有配置web.xml映射的原因。参考我们教程中对web.xml配置的介绍:
    http://family168.com/tutorial/jsp/html/jsp-ch-06.html#jsp-ch-06-01
      

  2.   

    TOMCAT的配置文件要与项目WEB文件里的配置是对应的,
    你的TOM6是安装版的还是解压版的?
      

  3.   

    我的TOMCAT是安装版的,两者会不一样吗?
      

  4.   

    如果是TOMCAT启动成功那就是/servlet/HelloServlet 路径有问题估计是你HelloServlet有问题,也就是你的Servlet有问题,看下你的web.xml
      

  5.   

    我的web.xml是这样的:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!--
     Licensed to the Apache Software Foundation (ASF) under one or more
      contributor license agreements.  See the NOTICE file distributed with
      this work for additional information regarding copyright ownership.
      The ASF licenses this file to You under the Apache License, Version 2.0
      (the "License"); you may not use this file except in compliance with
      the License.  You may obtain a copy of the License at      http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    --><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">  <display-name>Welcome to Tomcat</display-name>
      <description>
         Welcome to Tomcat
      </description><servlet>
      <servlet-name>HelloServlet</servlet-name>
      <display-name>HelloServlet</display-name>
      <description>A test Servlet</description>
      <servlet-class>HelloServlet</servlet-class>
      </servlet>
      <servlet-mapping>
      <servlet-name>HelloServlet</servlet-name>
      <url-pattern>/HelloServlet</url-pattern>
      </servlet-mapping>
    </web-app>
    请各位大侠帮忙看下.谢谢各位.
      

  6.   

    CLASS的配置路径改下就OK了 晕了/```怎么好几天了还没结贴呢?
      

  7.   

    已经很明显了啊,TOMCAT提示错误路径是message /servlet/HelloServlet
    而你的WEB。XML是<url-pattern>/HelloServlet </url-pattern>
      

  8.   

    http://localhost:8080/HelloServlet