search

Home  >  Q&A  >  body text

java - Myeclipse中创建servlet配置web.xml,访问servlet类时一直提示500

Myeclipse中创建servlet配置web.xml,访问servlet类时一直提示HTTP Status 500 - Error instantiating servlet class sevlet.test.AServlet
xml配置改了很多次,网上也查了很久,不知道为什么一直有问题。

访问时500错误

异常信息

PHP中文网PHP中文网2807 days ago835

reply all(4)I'll reply

  • PHPz

    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

    reply
    0
  • 黄舟

    黄舟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

    1. Servlet does not inherit HttpServlet or implement the Servlet interface

    2. The <servlet-class> in the web.xml file is written incorrectly and does not match the real package name and class name

    3. 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.

    reply
    0
  • PHPz

    PHPz2017-04-18 10:28:44

    sevlet.test.Aservlet sevlet Look at the package name of Aservlet

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-18 10:28:44

    Errors of 500 usually indicate a problem with the code. You have to start looking at the code

    reply
    0
  • Cancelreply