Myeclipse中创建servlet配置web.xml,访问servlet类时一直提示HTTP Status 500 - Error instantiating servlet class sevlet.test.AServlet
xml配置改了很多次,网上也查了很久,不知道为什么一直有问题。
访问时500错误
异常信息
PHPz2017-04-18 10:28:44
class not found. Check if your container cannot find this class. No, check if the output classpath of src is not set properly
黄舟2017-04-18 10:28:44
500 error reason
An error occurred during the execution of the service method of the requested Servlet, and the program cannot continue to run.
Possible reasons
Servlet does not inherit HttpServlet or implement the Servlet interface
The <servlet-class> in the web.xml file is written incorrectly and does not match the real package name and class name
The code in the service method throws an exception when running
Analysis of your situation
From the screenshot information you gave (the one where Tomcat starts to load), we can basically conclude that the red line in the content is an error in the specified class in the <servlet-class> tag of your web.xml file. Please check and confirm.
天蓬老师2017-04-18 10:28:44
Errors of 500 usually indicate a problem with the code. You have to start looking at the code