【发布时间】:2011-06-21 21:24:56
【问题描述】:
我编写了一个小 servlet,需要使用 tomcat 进行部署。我的服务器是 tomcat 6。我首先尝试只拖动 war 文件并将其解压缩,然后我无法访问 url(404 错误)。然后我什至删除了部署并尝试使用tomcat管理器。当我单击部署时显示“确定”,但未显示在部署的应用程序列表中。
我使用 Eclipse (ganymede) 创建了 war 文件。解压后的目录结构看起来不错。我在 localhost:8080 上运行。这是我的 web.xml。也许这里有什么问题?
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<servlet>
<servlet-name>Auth</servlet-name>
<servlet-class>serv.Authenticate</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Auth</servlet-name>
<url-pattern>/authenticate</url-pattern>
</servlet-mapping>
</web-app>
我读到过,也许我需要对 server.xml 做点什么。但我在那里环顾四周,没有任何 tomcat 的默认网络应用程序的条目。如何注册我的应用,以便 tomcat 像其他应用一样提供它?
【问题讨论】: