gpt4 book ai didi

java - NoSuchMethodException : org. apache.fop.apps.FopFactory.newInstance()

转载 作者:行者123 更新时间:2023-12-02 12:03:18 25 4
gpt4 key购买 nike

这段代码:

WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(is);
FOSettings foSettings = Docx4J.createFOSettings();
foSettings.setWmlPackage(wordMLPackage);
Docx4J.toFO(foSettings, baos, Docx4J.FLAG_EXPORT_PREFER_XSL);
//Docx4J.toPDF(wordMLPackage, baos);

抛出此错误:

java.lang.NoSuchMethodException: org.apache.fop.apps.FopFactory.newInstance() at java.lang.Class.getDeclaredMethod(Class.java:2130) at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.createFopFactory(FORendererApacheFOP.java:335) at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.getFopFactory(FORendererApacheFOP.java:253) at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:119) at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:168) at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:47) at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:82) at org.docx4j.Docx4J.toFO(Docx4J.java:575)

Maven

<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-export-fo</artifactId>
<version>3.3.6</version>
</dependency>

这里可能出了什么问题?

最佳答案

乍一看,确认 FOP 2.2 已在您的路径上。

但是从堆栈跟踪来看,这看起来不像export-fo v3.3.6,因此请检查您的类路径以确保您没有一些早期的export-fo。

关于java - NoSuchMethodException : org. apache.fop.apps.FopFactory.newInstance(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47084153/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com