servlet部署问题,Error instantiating servlet class com.example.servlets.HelloServlet
我在eclipse中把代码写好后,再往tomcat上部署,路径是E:\Download\apache-tomcat-7.0.57-windows-x64\apache-tomcat-7.0.57\webapps\test,
然后我在WEB-INF中增加了一个web.xml,
内容是<?xml version="1.0" encoding="ISO-8859-1"?>
<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_3_0.xsd"
version="3.0"
metadata-complete="true">
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>com.example.servlets.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>
WEB-INF\classes\com\example\servlets是从eclipse中复制过来的,里面有HelloServlet.class,
然后去配置了E:\Download\apache-tomcat-7.0.57-windows-x64\apache-tomcat-7.0.57\conf下的server.xml文件,
在host标签里面增加了一行
<Context docBase="E:\Download\apache-tomcat-7.0.57-windows-x64\apache-tomcat-7.0.57\webapps\test" path="/test" reloadable="false"/>
然后重启tomcat,调用就报错了,搞不懂是什么原因,我哪里配置错了吗?
求教!
错误内容:
type Exception report
message Error instantiating servlet class com.example.servlets.HelloServlet
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error instantiating servlet class com.example.servlets.HelloServlet