当前位置:网站首页>问题解决:OfficeException: failed to start and connect(一)
问题解决:OfficeException: failed to start and connect(一)
2022-07-01 06:28:00 【Going_man】
问题:OfficeException: failed to start and connect(一)
场景:重启tomcat服务后,预览系统启动不了
输出日志:启动office组件失败,请检查office组件是否可用
报错:org.artofsolving.jodconverter.office.OfficeException: failed to start and connect
认定原因一:
1、杀死进程杀死不成功和启动软件进程互相冲突
boolean killOffice = killProcess();
if (killOffice) {
logger.warn("检测到有正在运行的office进程,已自动结束该进程");
}
try {
DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
configuration.setOfficeHome(officeHome);
configuration.setPortNumber(8100);
// 设置任务执行超时为25分钟
configuration.setTaskExecutionTimeout(1000 * 60 * 25L);
// 设置任务队列超时为24小时
configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);
configuration.setMaxTasksPerProcess(1000);
officeManager = configuration.buildOfficeManager();
officeManager.start();
} catch (Exception e) {
logger.error("启动office组件失败,请检查office组件是否可用");
throw e;
}
//杀死进程核心代码
String[] cmd ={
"cmd","/c","taskkill /im soffice.bin /f"};
Process process= Runtime.getRuntime().exec(cmd);
//输出为1,可见杀死进程失败
logger.warn("killProcess:process"+process.waitFor());
解决方式一:
我将杀死soffice服务进程的代码注释,让其直接进行启动!
//boolean killOffice = killProcess();
//if (killOffice) {
// logger.warn("检测到有正在运行的office进程,已自动结束该进程");
//}
try {
DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
configuration.setOfficeHome(officeHome);
configuration.setPortNumber(8100);
// 设置任务执行超时为25分钟
configuration.setTaskExecutionTimeout(1000 * 60 * 25L);
// 设置任务队列超时为24小时
configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);
configuration.setMaxTasksPerProcess(1000);
officeManager = configuration.buildOfficeManager();
officeManager.start();
} catch (Exception e) {
logger.error("启动office组件失败,请检查office组件是否可用");
throw e;
}
发现它可以成功启动!又尝试在杀死后面加了个延时!
Thread.sleep(5000);
结果也是可以启动!
结论一:
所以最终问题在于杀死进程命令执行后,不能立马执行启动命令,会导致报错。
边栏推荐
- 第五章 输入/输出(I/O)管理
- To sort out the anomaly detection methods, just read this article!
- 数据库笔记
- 常用快捷键
- 三分钟带你快速了解网站开发的整个流程
- 网络爬虫
- 软件工程复习
- How does the port scanning tool help enterprises?
- [ManageEngine Zhuohao] what is network operation and maintenance management and what is the use of network operation and maintenance platform
- 【Unity Shader 描边效果_案例分享第一篇】
猜你喜欢

自开发软件NoiseCreater1.1版本免费试用

谷粒商城-环境(p1-p27)

C language course set up library information management system (big homework)

C language course set up property fee management system (big work)

HCM Beginner (IV) - time
![[automatic operation and maintenance] what is the use of the automatic operation and maintenance platform](/img/14/756d566744d6e4a988a284c5b30130.png)
[automatic operation and maintenance] what is the use of the automatic operation and maintenance platform

Detailed steps for installing redis on Windows system

问题:OfficeException: failed to start and connect(三)

async 与 await

Idea easy to use plug-in summary!!!
随机推荐
第五章 输入/输出(I/O)管理
C语言课设学生考勤系统(大作业)
解决The code generator has deoptimised the styling of xxxx.js as it exceeds the max of 500kb
Grain Mall - environment (p1-p27)
Promise
[summary of problem thinking] Why is the register reset performed in user mode?
Database notes
[summary of knowledge points] chi square distribution, t distribution, F distribution
Draw a directed graph based on input
JMM details
To sort out the anomaly detection methods, just read this article!
[unity shader custom material panel part II]
微信公众号内嵌跳转微信小程序方案总结
谷粒商城-环境(p1-p27)
[ManageEngine Zhuohao] helps Julia college, the world's top Conservatory of music, improve terminal security
Is the account opening of Huafu securities safe and reliable? How to open Huafu securities account
Gson的@JsonAdater注解的几种方式
C语言课设工资管理系统(大作业)
[wechat applet] view container and basic content components
Dongle data collection