项目

一般

简介

V9部署数科后使用下载功能报java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.setContentLengthLong(J)V

由 吕 鹏钦 在 超过 2 年 之前添加

报错如下:

2022-06-30 21:14:11 错误 [apusic.web.web-reader./web-reader-Thread 219] 执行Servlet时发生错误。
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.setContentLengthLong(J)V
    at com.suwell.reader.v3.ServletAction.replyDownload(ServletAction.java:194)
    at com.suwell.reader.v3.impl.doc.Download.doDownload(Download.java:80)
    at com.suwell.reader.v3.impl.doc.Download.doAction(Download.java:44)
    at com.suwell.reader.v3.ReaderServlet.doGet(ReaderServlet.java:535)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
    at com.apusic.web.container.ServletComponent.service(ServletComponent.java:87)
    at com.apusic.web.container.ServletFilterWrapper.doFilter(ServletFilterWrapper.java:38)
    at com.apusic.web.container.FilterChainImpl.doFilter(FilterChainImpl.java:48)
    at com.suwell.reader.v3.prometheus.HistogramFilter.doFilter(HistogramFilter.java:64)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.WebContainer.invoke(WebContainer.java:1166)
    at com.apusic.web.container.WebContainer.doProcessRequest(WebContainer.java:947)
    at com.apusic.web.container.WebContainer.processRequest(WebContainer.java:809)
    at com.apusic.web.http.VirtualHost.processRequest(VirtualHost.java:370)
    at com.apusic.web.http.HttpServer.processRequest(HttpServer.java:317)
    at com.apusic.web.http.HttpConnectionHandler.service(HttpConnectionHandler.java:26)
    at com.apusic.web.http.ConnectionHandler.processRequest(ConnectionHandler.java:360)
    at com.apusic.web.http.ConnectionHandler.processConnection(ConnectionHandler.java:138)
    at com.apusic.web.http.ConnectionHandler.run(ConnectionHandler.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

排查过程:了解到他们使用本机V9不会报此错误,查看现场环境的V9版本号如下:

他本机的V9版本号如下:

解决方法:此问题为V9版本bug,替换附件中的apusic.jar即可解决