gpt4 book ai didi

java - 使用 PDF2DOM 将 PDF 解析为 HTML 返回 NoSuchMethodError

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

我有代码;

private void convert(ByteArrayInputStream byteArrayInputStream) {
try {
PDDocument pdf = PDDocument.load(byteArrayInputStream);
PDFDomTree parser = new PDFDomTree();
Document dom = parser.createDOM(pdf);
} catch (Exception e) {
e.printStackTrace();
}
}

此行时返回NoSuchMethodError;

Document dom = parser.createDOM(pdf);

错误:

NoSuchMethodError: com.google.common.collect.Sets$SetView.iterator()Lcom/google/common/collect/UnmodifiableIterator;

我的 jar 列表:...

activation-1.1
animal-sniffer-annotations-1.17
animal-sniffer-annotations-1.18
ant-1.6.5
antlr-2.7.7
antlr4-runtime-4.5.3
aopalliance-1.0
asm-5.0.3
asm-commons-5.0.3
asm-tree-5.0.3
asm-util-5.0.3
atmosphere-runtime-2.4.24.vaadin1
autocomplete-0.2.4
bcprov-jdk15-1.45
calendar-component-2.0.1
cas-client-core-3.3.3
checker-qual-2.5.2
checker-qual-2.8.1
classmate-1.3.0
colt-1.2.0
commons-codec-1.6
commons-collections-3.1
commons-collections-3.2.2
commons-collections4-4.1
commons-httpclient-3.1
commons-io-2.5
commons-lang-2.1
commons-lang3-3.0
commons-logging-1.1.3
commons-net-3.6
core-2.4.0
core-3.3.0
cssbox-4.15
cssparser-0.9.18
curvesapi-1.04
dom4j-1.6.1
ehcache-2.10.3
EnlilWebClient-1
error_prone_annotations-2.2.0
error_prone_annotations-2.3.2
esapi-2.0GA
exporter-2.0.0
failureaccess-1.0.1
failureaccess-1.0
FastInfoset-1.2.13
flute-1.3.0.gg2
fontbox-2.0.4
FontVerter-1.2.22
gelfclient-1.4.0
gentyref-1.2.0.vaadin1
gmbal-3.1.0-b001
gmbal-api-only-3.1.0-b001
gson-2.8.1
guava-28.1-jre
gwt-dev-2.8.2
gwt-elemental-2.8.2
gwt-user-2.8.2
ha-api-3.1.9
hamcrest-core-1.3
hibernate-commons-annotations-5.0.1.Final
hibernate-core-5.2.12.Final
hibernate-ehcache-5.2.12.Final
hibernate-jpa-2.1-api-1.0.0.Final
hibernate-validator-5.1.0.CR1
htmlunit-2.19
htmlunit-core-js-2.17
httpclient-4.3.1
httpcore-4.3
httpmime-4.5.1
icu4j-50.1.1
inputmask-1.0.2
istack-commons-runtime-2.19
itextpdf-5.5.10
j2objc-annotations-1.1
j2objc-annotations-1.3
jackson-annotations-2.5.0
jackson-core-2.4.1
jackson-databind-2.5.2
jackson-datatype-hibernate4-2.4.1
jai-imageio-core-1.3.1
jandex-2.0.3.Final
javaee-api-8.0
javaee-web-api-8.0
javase-2.4.0
javase-3.3.0
javassist-3.20.0-GA
javax.annotation-api-1.2
javax.mail-1.6.0
javax.servlet-api-3.1.0
javax.xml.rpc-api-1.1
javax.xml.soap-api-1.3.7
jaxb1-impl-2.2.4-1
jaxb-api-2.2.12-b140109.1041
jaxb-core-2.2.10-b140802.1033
jaxb-impl-2.2.10-b140802.1033
jaxrpc-api-1.1
jaxrpc-impl-1.1.3_01
jaxrpc-spi-1.1.3_01
jaxws-api-2.2.11
jaxws-rt-2.2.10
jboss-logging-3.3.0.Final
jboss-transaction-api_1.2_spec-1.0.1.Final
jcip-annotations-1.0
jcommander-1.48
jcommon-1.0.23
jersey-bundle-1.19
jersey-core-1.19
jersey-multipart-1.19
jersey-server-1.19
jetty-continuation-9.4.8.v20171121
jfreechart-1.0.19
jmac-1.0-rev-1
joda-time-1.6.2
jsinterop-annotations-1.0.2
jsinterop-annotations-1.0.2-sources
json-simple-1.1.1
jsoup-1.11.2
jsr105-api-1.0.1
jsr105-impl-1.0.2
jsr181-api-1.0-MR1
jsr305-1.3.9
jsr305-3.0.2
jsr311-api-1.1.1
jstyleparser-3.3
jul-to-slf4j-1.6.1
junit-4.11
kerberos-wss-extension-1.0
log4j-1.2.17
log4j-over-slf4j-1.6.1
mail-1.4.5
management-api-3.2.1-b001
messagebox-4.0.21
metro-cm-api-2.3.1
metro-commons-2.3.1
metro-config-api-2.3.1
metro-runtime-api-2.3.1
mimepull-1.9.4
nekohtml-1.9.22
netty-all-4.0.29.Final
not-yet-commons-ssl-0.3.9
ojdbc-8
opensaml-2.5.1-1
openws-1.4.2-1
PasswordEncoder-0.0.1
pdf2dom-1.8
pdfbox-2.0.4
poi-3.16
poi-ooxml-3.16
poi-ooxml-schemas-3.16
policy-2.4
popupbutton-3.0.0
popupextension-1.0.1
product-tour-0.5
reflections-0.9.11
resolver-20050927
saaj-impl-1.3.25
sac-1.3
saml-jaxb10-bindings-1.0
serializer-2.7.1
slf4j-api-1.7.1
slf4j-simple-1.7.25
soaptcp-api-2.3.1
spring-aop-4.3.9.RELEASE
spring-beans-4.3.9.RELEASE
spring-context-4.3.9.RELEASE
spring-core-4.3.9.RELEASE
spring-expression-4.3.9.RELEASE
spring-security-cas-4.2.3.RELEASE
spring-security-config-4.2.3.RELEASE
spring-security-core-4.2.3.RELEASE
spring-security-web-4.2.3.RELEASE
spring-web-4.3.9.RELEASE
stax2-api-3.1.1
stax-api-1.0.1
stax-ex-1.7.7
streambuffer-1.5.3
tapestry-4.0.2
timerextension-0.2.1
unbescape-1.1.6.RELEASE
vaadin-autocomplete-1.1.1
vaadin-charts-4.0.0
vaadin-charts-model-4.0.0
vaadin-client-8.5.1
vaadin-client-compiled-8.5.1
vaadin-client-compiler-8.5.1
vaadin-combobox-multiselect-2.6
vaadin-context-menu-2.1.0
vaadin-onoffswitch-1.1.0
vaadin-push-8.5.1
vaadin-sass-compiler-0.9.13
vaadin-scrollable-panel-2.0
vaadin-server-8.5.1
vaadin-shared-8.5.1
vaadin-slf4j-jdk14-1.6.1
vaadin-sliderpanel-2.2.0
vaadin-spring-3.1.0
vaadin-themes-8.5.1
validation-api-1.0.0.GA-sources
validation-api-1.1.0.Final
velocity-1.5
webservices-api-2.3.1
webservices-rt-2.3.1
webservices-tools-2.3.1
websocket-api-9.2.13.v20150730
websocket-client-9.2.13.v20150730
websocket-common-9.2.13.v20150730
woodstox-core-asl-4.2.0
wsit-api-2.3.1
wsit-impl-2.3.1
wsmc-api-2.3.1
wsrm-api-2.3.1
wssx-api-2.3.1
wstx-api-2.3.1
xalan-2.7.1
xercesImpl-2.10.0
xercesImpl-2.12.0
xml-apis-1.4.01
xmlbeans-2.6.0
xml-resolver-1.2
xmlsec-1.4.4
xmltooling-1.3.2-1

我有很多库。但我不知道这些库中的哪一个可能会发生冲突。我的项目是大型项目。我希望有人知道这个问题。谢谢..

最佳答案

据我检查,当 Maven 将更多依赖项解析到同一库但不同版本时,它会采用它找到的第一个版本并忽略其他版本。就您而言,您可能明确声明了对 Guava 28.1 的依赖。但是 pdfbox 需要不同的版本,您在库中看不到该版本,因为它被忽略了。我建议您:

  1. 从项目中删除尽可能多的依赖项,仅保留对 pdfbox 的依赖项。
  2. 检查它需要什么版本。命令 mvn dependency:tree -Dverbose 可能会帮助您。
  3. 将您的依赖项恢复到原始状态,并将 Guava 依赖项设置为该版本。
  4. 祈祷另一个库也不需要不同版本的 Guava。

编辑:您可能会发现此线程很有用。它谈到忽略同一 jar 的其他版本。

maven dependency plugin ignores dependency versions?

编辑 2:就我而言,需要 Guava 15.0。

关于java - 使用 PDF2DOM 将 PDF 解析为 HTML 返回 NoSuchMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59104661/

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