Apache Tika ArchiveStreamFactory.detect错误 [英] Apache Tika ArchiveStreamFactory.detect error

查看:289
本文介绍了Apache Tika ArchiveStreamFactory.detect错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Java与apache tika 1.18结合使用,以将某些文件转换为TXT. 当我尝试使用AutoDetectParser()时,出现错误:

I'm using java with apache tika 1.18 to convert some files to TXT. When I try to use the AutoDetectParser(), I'm getting the error :

[ERROR]在错误处理期间发生错误,请放弃! org.apache.commons.compress.archivers.ArchiveStreamFactory.detect(Ljava/io/InputStream;)Ljava/lang/String; [错误] SRVE0777E:应用程序类'org.apache.cxf.service.invoker.AbstractInvoker.createFault:162'引发异常. org.apache.cxf.interceptor.Fault:org.apache.commons.compress.archivers.ArchiveStreamFactory.detect(Ljava/io/InputStream;)Ljava/lang/String; 在org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162) 在[内部课程] 引起原因:java.lang.NoSuchMethodError:org.apache.commons.compress.archivers.ArchiveStreamFactory.detect(Ljava/io/InputStream;)Ljava/lang/String;

[ERROR ] Error occurred during error handling, give up! org.apache.commons.compress.archivers.ArchiveStreamFactory.detect(Ljava/io/InputStream;)Ljava/lang/String; [ERROR ] SRVE0777E: Exception thrown by application class 'org.apache.cxf.service.invoker.AbstractInvoker.createFault:162' org.apache.cxf.interceptor.Fault: org.apache.commons.compress.archivers.ArchiveStreamFactory.detect(Ljava/io/InputStream;)Ljava/lang/String; at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162) at [internal classes] Caused by: java.lang.NoSuchMethodError: org.apache.commons.compress.archivers.ArchiveStreamFactory.detect(Ljava/io/InputStream;)Ljava/lang/String;

我在互联网上叮叮当当,发现此错误与commom_compress的错误版本有关,似乎commom_compress 1.14的早期版本中不存在此方法.就我而言,版本是1.16.1.

I was dinging on internet and found this error related wrong version of commom_compress, appears this method doesn't exist in versions previous of 1.14 of commom_compress. In my case the version is 1.16.1.

构建项目后,我检查了其中的库,只有正确的版本.

After build the project, I checked the libs inside and there is only the correct version.

我正在使用IBM Liberty 18.0 ...现在我真的迷失了解决此问题的选项.

I'm using IBM Liberty 18.0 ... and now I'm really lost about options to solve this problem.

当我使用特定的解析器(如PDFParser())时,一切正常!

When I use the specific parser, like PDFParser(), everything works fine!

有什么想法吗?

谢谢

推荐答案

问题来源:

Spark 2.x发行版包括commons-compress的旧版本,而Tika库依赖于commons-compress库的1.18版本.

Source of the issue:

Spark 2.x distributions include old versions of commons-compress, while Tika library depends on version 1.18 of commons-compress library.

在spark-shell或spark-submit中使用--driver-class-path参数指向正确版本的commons-compress库.

Use --driver-class-path argument in your spark-shell or spark-submit to point to a the right version of commons-compress library.

spark-submit 
     --driver-class-path ~/.m2/repository/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar
     --class {you.main.class}
....

检查我的详细答案在这里.

这篇关于Apache Tika ArchiveStreamFactory.detect错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆