Centos环境调用通过java程序调用libreoffice服务转pdf时报错OpenOfficeException: conversion failed: input document is null after loading,具体错误:
com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException: conversion failed: input document is null after loading
at com.artofsolving.jodconverter.openoffice.converter.StreamOpenOfficeDocumentConverter.loadAndExport(StreamOpenOfficeDocumentConverter.java:111)
at com.artofsolving.jodconverter.openoffice.converter.StreamOpenOfficeDocumentConverter.convertInternal(StreamOpenOfficeDocumentConverter.java:90)
at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:82)
at com.artofsolving.jodconverter.openoffice.converter.StreamOpenOfficeDocumentConverter.convertInternal(StreamOpenOfficeDocumentConverter.java:76)
at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:104)
at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:74)
at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:70)
方案一:具体执行是在com.artofsolving.jodconverter.openoffice.converter.StreamOpenOfficeDocumentConverter类的loadAndExport方法中的desktop.loadComponentFromURL一行,执行得到的document为null,因此报错。由于底层实现在unoil-3.0.1.jar包,非开源,无法进一步分析,未找到根本yuanyin
方案二:重启libreoffice服务,调用恢复正常。