上传docx,xslx,pptx时,Sling日志中的NoClassDefFoundError错误

时间:2013-01-24 22:36:58

标签: apache jackrabbit apache-tika sling

在将任何Office 2007文档(例如pptx,docx,xslx)上传到Sling时,我收到以下多个错误(请参阅下面的内容 - 每个文件一个)。我正在使用 Sling 6 稳定独立。

还有其他人遇到这种情况吗? tika捆绑包有任何已知问题吗?

由于

23.01.2013 14:32:27.248 *WARN* [jackrabbit-pool-1] org.apache.jackrabbit.core.query.lucene.LazyTextExtractorField Failed to extract text from a binary property org.apache.tika.exception.TikaException: Unexpected RuntimeException from org.apache.tika.parser.microsoft.ooxml.OOXMLParser@5217e8de
                at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:122)
                at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:101)
                at org.apache.jackrabbit.core.query.lucene.JackrabbitParser.parse(JackrabbitParser.java:189)
                at org.apache.jackrabbit.core.query.lucene.LazyTextExtractorField$ParsingTask.run(LazyTextExtractorField.java:174)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
                at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
                at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
                at org.apache.poi.xwpf.usermodel.XWPFFactory.createDocumentPart(XWPFFactory.java:60)
                at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:256)
                at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:196)
                at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:94)
                at org.apache.poi.xwpf.extractor.XWPFWordExtractor.<init>(XWPFWordExtractor.java:45)
                at org.apache.poi.extractor.ExtractorFactory.createExtractor(ExtractorFactory.java:111)
                at org.apache.poi.extractor.ExtractorFactory.createExtractor(ExtractorFactory.java:86)
                at org.apache.tika.parser.microsoft.ooxml.OOXMLParser.parse(OOXMLParser.java:47)
                at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:120)
                ... 11 more
Caused by: java.lang.reflect.InvocationTargetException
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                at org.apache.poi.xwpf.usermodel.XWPFFactory.createDocumentPart(XWPFFactory.java:58)
                ... 19 more
Caused by: java.lang.NoClassDefFoundError: org/openxmlformats/schemas/wordprocessingml/x2006/main/SettingsDocument$Factory
                at org.apache.poi.xwpf.usermodel.XWPFSettings.readFrom(XWPFSettings.java:129)
                at org.apache.poi.xwpf.usermodel.XWPFSettings.<init>(XWPFSettings.java:43)
                ... 24 more
Caused by: java.lang.ClassNotFoundException: org.openxmlformats.schemas.wordprocessingml.x2006.main.SettingsDocument$Factory not found by org.apache.tika.bundle [63]
                at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)
                at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
                at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
                ... 26 more

1 个答案:

答案 0 :(得分:0)

这是由于tika 0.6包中缺少/不正确的依赖性。

我必须使用以下更改重新编译tika 0.6才能正常工作。然后我在sling独立jar文件中替换了tika包。如果有更好的方法,请告诉我,因为我是一名java初学者。感谢

对tika-0.6.tika-parsers.pom.xml所做的更改:

添加了:

<dependency>
      <groupId>org.apache.poi</groupId>
      <artifactId>ooxml-schemas</artifactId>
      <version>1.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.poi</groupId>
      <artifactId>poi-ooxml-schemas</artifactId>
      <version>${poi.version}</version>
    </dependency>

移除:

<dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-stax-api_1.0_spec</artifactId>
      <version>1.0.1</version>
    </dependency>