控制可以打印“开始转换。。。”,但是执行下一句马上就抛出类未找到的异常,这个类是方法里面的一个类,但是根本就没有进入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)