servlet部署问题,Error instantiating servlet class com.example.servlets.HelloServlet

hotkarriver 2015-04-17 11:37:25
我在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
...全文
646 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sandbar_ 2015-11-26
  • 打赏
  • 举报
回复
求解决方法,感谢
hotkarriver 2015-04-17
  • 打赏
  • 举报
回复
哎,自己解决了,来个人留言给分,先到先得
hotkarriver 2015-04-17
  • 打赏
  • 举报
回复
在eclipse里面启动一个tomcat server,去连接是好的,哎,到tomcat文件夹里去配置就不行,不知道哪配置错了。。。。。。

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧