问题java.net.ConnectException: connection failed: socket,host=localhost,port=8100,tcpNoDelay=1
http://blog.csdn.net/yl419440513/article/details/6872614
java.net.ConnectException: connection failed: socket,host=localhost,port=8100,tcpNoDelay=1: java.net.ConnectException: Connection refused: connect at com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.connect(AbstractOpenOfficeConnection.java:79) at com.online.doc.service.JOD4DocToPDF.docToPdf(JOD4DocToPDF.java:35) at com.online.doc.service.JOD4DocToPDF.run(JOD4DocToPDF.java:65) Exception in thread "Thread-0" java.lang.NullPointerException at com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.disconnect(AbstractOpenOfficeConnection.java:88) at com.online.doc.service.JOD4DocToPDF.docToPdf(JOD4DocToPDF.java:46) at com.online.doc.service.JOD4DocToPDF.run(JOD4DocToPDF.java:65)
今天做文档转换时遇到这个问题.源码
就是这样,我在使用时是这样调用的
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);其实是没问题,但是我在ping localhost 8100时没反应,而ping 127.0.0.1 8100有监听,由于网络文盲,个人觉得可能是在(C:\WINDOWS\system32不知是不是这)里面的(host.txt也不只是不是这个格式)里面的配置被我改了吧,装Oracle时。所以我就改用了第二个方法
OpenOfficeConnection connection = new SocketOpenOfficeConnection("yourIP",8100);
问题完美解决