我正在学习servlet并按照本教程进行操作(我逐步进行操作,但我将项目命名为“ SampleServlet”,而不是“ de.vogella.wtp.filecounter”)。当我启动服务器(步骤5.4)时,出现404页面错误:
HTTP Status 404 - /SampleServlet/servlet/de.vogella.wtp.filecounter.servlets.FileCounter
type Status report
message /SampleServlet/servlet/de.vogella.wtp.filecounter.servlets.FileCounter
description The requested resource (/SampleServlet/servlet/de.vogella.wtp.filecounter.servlets.FileCounter) is not available.
从哪里开始调试?服务器启动时,控制台中有多个“ INFO”,并且有一个警告:
29.08.2011 21:03:44 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SampleServlet' did not find a matching property.
我需要更改任何首选项吗?
本教程建议您通过http:// localhost:8080 / de.vogella.wtp.filecounter / FileCounter调用它。项目名称默认为de.vogella.wtp.filecounter
已更改的上下文名称SampleServlet
,因此您需要通过http:// localhost:8080 / SampleServlet / FileCounter调用servlet 。
至于SetPropertiesRule
警告,请忽略它,这是正常的。Eclipse只是在Tomcat的<Context>
元素中添加了一个额外的属性,以便能够将部署的Web应用程序与特定项目相关联。Tomcat只是在开玩笑,因为它无法将其识别为预定义的<Context>
属性之一。但是,这对于最终用户实际输入错字的情况很有帮助。只是忽略它。导出Webapp并将其部署在实际生产服务器上时,您将看不到它。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句