qq_34350475 2017-06-28 06:17 采纳率: 80%
浏览 2946
已采纳

在servlet中刚调用其他类的方法就报错

控制可以打印“开始转换。。。”,但是执行下一句马上就抛出类未找到的异常,这个类是方法里面的一个类,但是根本就没有进入doc2Html这个方法体中就抛出了异常,单独运行测试ToWord中的方法是可以的。
servlet:

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ......
            try{
                        ......
                        System.out.println("开始转换。。。");
                    resultFile= ToWord.doc2Html("F:/upload/"+filename, "F:/change");
                }
            }
        }catch (Exception e) {
            message= "文件上传失败!";
            e.printStackTrace();

        }
}

ToWord.class

public class ToWord(){

                    doc2Html(){
                    ......
                    System.out.println("连接中。。。");
                    OpenOfficeConnection connection =
                    new SocketOpenOfficeConnection(soffice_host, Integer.parseInt(soffice_port));
                    System.out.println("连接:"+connection);
                    ......
                    }
    }

控制台:

开始转换。。。
六月 28, 2017 11:38:13 上午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [UploadServlet] in context with path [/TestIOStream] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at com.fdauto.servlet.UploadServlet.doGet(UploadServlet.java:99)
at com.fdauto.servlet.UploadServlet.doPost(UploadServlet.java:116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

  • 写回答

5条回答 默认 最新

  • qq2443393175 2017-06-28 07:14
    关注

    ClassNotFoundException,用的第三方插件转换文件,是不是 少了 jar 包?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥15 QT6颜色选择对话框显示不完整
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥15 DS18B20内部ADC模数转换器