开发者社区> 问答> 正文

关于在不同的机器上调用openoffice服务的问题?报错

我目前正在使用jodconverter调用openoffice服务将文档转pdf,调用方法

OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
connection.connect();
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
converter.convert(file, outputFile);
connection.disconnect();

现在遇到的问题是,当openoffice安装在本台机器上时连接没有问题,但是当openoffice安装在另一台机器上时,使用下面的代码设置目标服务器IP

OpenOfficeConnection connection = new SocketOpenOfficeConnection("192.168.1.11",8100);
connection.connect();			
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);			
converter.convert(file, outputFile);
connection.disconnect();



就会报错 

connection failed: socket,host=192.168.1.11,port=8100,tcpNoDelay=1: java.net.ConnectException: Connection refused
<p>
	<br>
</p>
<p>
	<br>
</p>

请问有知道是什么原因的么?

展开
收起
爱吃鱼的程序员 2020-06-10 10:22:54 934 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
    有人么首先检查下防火墙,再看看192.168.1.11的8100端口是否已监听。防火墙是关闭的,端口也是监听中的,我在安装openoffice的机器上代码都能执行,放其他机器就不行我也是这个问题。请问题主有解决么?回复 @yuanqy:666666,感谢!回复 @那位先生:无意间解决了。远程服务启动的时候,host=真实的对外IP,不能写127.0.0.1。还有远程传输。converter应该用:DocumentConverterconverter=newStreamOpenOfficeDocumentConverter(connection);就ok了没有我也遇到了这个问题,能说的更详细些吗?谢谢!
    看楼上

    如果是云服务器,使用内网ip(ifconfig所显示的ip)

    如果是多网卡,使用对外提供服务的ip地址。

    2020-06-10 10:23:11
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载