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

时间:2019-01-14 05:44:19

标签: java servlets

HTTP状态500-内部服务器错误

类型异常报告

messageInternal服务器错误

说明服务器遇到内部错误,导致服务器无法满足此请求。

例外 javax.servlet.ServletException:类test.testing1不是Servlet

根本原因 java.lang.ClassCastException:test.testing1无法转换为javax.servlet.Servlet

1 个答案:

答案 0 :(得分:0)

尝试这样:

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);

    }
}