简体   繁体   English

收到错误 500 内部服务器错误

[英]Getting an error 500 internal server error

HTTP Status 500 - Internal Server Error HTTP 状态 500 - 内部服务器错误

type Exception report输入异常报告

messageInternal Server Error消息内部服务器错误

descriptionThe server encountered an internal error that prevented it from fulfilling this request.说明服务器遇到内部错误,无法完成此请求。

exception javax.servlet.ServletException: Class test.testing1 is not a Servlet异常 javax.servlet.ServletException:类 test.testing1 不是 Servlet

root cause java.lang.ClassCastException: test.testing1 cannot be cast to javax.servlet.Servlet根本原因 java.lang.ClassCastException: test.testing1 不能转换为 javax.servlet.Servlet

Try like this:像这样尝试:

public class testing1 extends PDFTOEXCEL implements Servlet {
    protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/html;charset=UTF-8");
        try (PrintWriter out = response.getWriter()) {
            out.println("converted sucessfully");
        }
    }

    @Override
    public void destroy() {
        // TODO Auto-generated method stub

    }

    @Override
    public void init(ServletConfig config) throws ServletException {
        // TODO Auto-generated method stub

    }

    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        processRequest((HttpServletRequest)req, (HttpServletResponse)res);

    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM