为了账号安全,请及时绑定邮箱和手机立即绑定

The server encountered an internal error that prevented it from fulfilling this request.

HTTP Status 500 - Error instantiating servlet class servlet.ListServlet

type Exception report

message Error instantiating servlet class servlet.ListServlet

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Error instantiating servlet class servlet.ListServlet
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:662)


root cause

java.lang.ClassNotFoundException: servlet.ListServlet
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:662)


note The full stack trace of the root cause is available in the Apache Tomcat/7.0.75 logs.

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
	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">
  <display-name></display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  
  <servlet>
  	<servlet-name>ListServlet</servlet-name>
  	<servlet-class>servlet.ListServlet</servlet-class>
  </servlet>
  <servlet-mapping>
  	<servlet-name>ListServlet</servlet-name>
  	<url-pattern>/List.action</url-pattern>
  </servlet-mapping>
  
  <servlet>
  	<servlet-name>DeleteOneServlet</servlet-name>
  	<servlet-class>servlet.DeleteOneServlet</servlet-class>
  </servlet>
  <servlet-mapping>
  	<servlet-name>DeleteOneServlet</servlet-name>
  	<url-pattern>/DeleteOneServlet.action</url-pattern>
  </servlet-mapping>

</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
	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">
  <display-name></display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  
  <servlet>
  	<servlet-name>ListServlet</servlet-name>
  	<servlet-class>servlet.ListServlet</servlet-class>
  </servlet>
  <servlet-mapping>
  	<servlet-name>ListServlet</servlet-name>
  	<url-pattern>/List.action</url-pattern>
  </servlet-mapping>
  
  <servlet>
  	<servlet-name>DeleteOneServlet</servlet-name>
  	<servlet-class>servlet.DeleteOneServlet</servlet-class>
  </servlet>
  <servlet-mapping>
  	<servlet-name>DeleteOneServlet</servlet-name>
  	<url-pattern>/DeleteOneServlet.action</url-pattern>
  </servlet-mapping>

</web-app>
package Servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import service.Listservice;
import service.MaintainService;

import bean.Message;

@SuppressWarnings({ "serial", "unused" })
public class ListServlet extends HttpServlet {

	public ListServlet() {
		super();
	}

	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
			 //设置字符编码
			 request.setCharacterEncoding("utf-8");
			 response.setCharacterEncoding("utf-8");
			 //接受页面的值
			 String command=request.getParameter("command");
			 String description=request.getParameter("description");
			 //向页面传值
			 request.setAttribute("command", command);
			 request.setAttribute("description", description);
			 Listservice listservice=new Listservice();
			 //查询消息列表并传给页面
			 request.setAttribute("messageList", listservice.queryMessageList(command, description));
			 //向页面跳转
			 request.getRequestDispatcher("/WEB-INF/jsp/back/list.jsp").forward(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doGet(request, response);
	}

	public void init() throws ServletException {
		// Put your code here
	}

}

我怀疑是xml配置错了,帮我看看哪不对,谢谢

正在回答

1 回答

如果我没有看错,是你的xml文件配置信息写错了。

 <servlet>

      <servlet-name>ListServlet</servlet-name>

      <servlet-class>servlet.ListServlet</servlet-class>

  </servlet>

servlet-class中的值应该为Servlet.ListServlet,应该是区分大小写的,你的ListServlet类是放置在Servlet包下的

0 回复 有任何疑惑可以回复我~
#1

二道桥十三太保 提问者

你眼睛好尖,之前都没注意到,明天我去试试
2017-04-11 回复 有任何疑惑可以回复我~
#2

二道桥十三太保 提问者

非常感谢!
2017-04-12 回复 有任何疑惑可以回复我~
#3

律生息

哥们,你真有耐心
2017-06-10 回复 有任何疑惑可以回复我~
#4

xiao梦 回复 律生息

你是说谁有耐心?
2017-06-28 回复 有任何疑惑可以回复我~
查看1条回复

举报

0/150
提交
取消

The server encountered an internal error that prevented it from fulfilling this request.

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信