Apache Tika编译错误

时间:2015-01-19 01:56:52

标签: maven javac apache-tika

我试图按照出现的内容进行非常简单的compilation instructions for Apache TikaJAXRS。我在Windows 8.1 64bit上运行。

  1. 从Apache Tika下载页面下载最新的稳定源代码或从Github中检索最新代码,
  2. 使用Maven构建源代码,
  3. 运行Apache Tika JAXRS服务器。
  4. 行。我已经完成了第1步,但我在第2步遇到了磕磕绊。显然,这里有一些未编写的先决条件,所以我试图解决它们如下:

    • 已安装的Java SDK 8u25
    • 将JAVA_HOME变量设置为C:\Program Files\Java\jdk1.8.0_25
    • 将CLASSPATH变量设置为.
    • 将JDK BIN目录添加到PATH变量:C:\Program Files\Java\jdk1.8.0_25\bin
    • 将Maven BIN目录添加到PATH变量:C:\apache-maven-3.2.5\bin

    然后从tika-1.7目录(src下载的zip内容)运行mvn install。在吐出下面粘贴的错误输出之前,编译快乐地进行了几分钟,此时编译似乎冻结。

    问题看起来像一样 - https://issues.apache.org/jira/browse/TIKA-1276 那里有一些关于重新创建捆绑包并修改文件以解决问题的讨论,但我坦率地发现,为了获得Tika的工作副本,我必须跳过这样的环节才是奇怪的。 - 没有提供二进制分发!

    我需要做些什么才能解决这个编译问题?

    -------------------------------------------------------
     T E S T S
    -------------------------------------------------------
    Running org.apache.tika.bundle.BundleIT
    [main] INFO org.ops4j.pax.exam.spi.DefaultExamSystem - Pax Exam System (Version: 2.2.0) created.
    Jan 19, 2015 11:48:40 AM org.ops4j.pax.url.mvn.internal.AetherBasedResolver resolve
    INFO: Resolved (org.junit:com.springsource.org.junit:jar:4.4.0) as C:\Users\Jason\.m2\repository\org\junit\com.springsource.org.junit\4.4.0\com.springsource.org.junit-4.4.0.jar
    ERROR: Bundle org.ops4j.pax.exam.rbc [1] Error starting link:classpath:META-INF/links/org.ops4j.pax.exam.rbc.link (org.osgi.framework.BundleException: Activator start error in bundle org.ops4j.pax.exam.rbc [1].)
    java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
        at org.ops4j.pax.exam.rbc.internal.Activator.<clinit>(Activator.java:47)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
        at java.lang.Class.newInstance(Class.java:438)
        at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4169)
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:1972)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1895)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory not found by org.ops4j.pax.exam.rbc [1]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 12 more
    ERROR: Bundle org.ops4j.pax.exam.extender.service [2] Error starting link:classpath:META-INF/links/org.ops4j.pax.extender.service.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.exam.extender.service [2]: Unable to resolve 2.0: missing requirement [2.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.6.0)(!(version>=2.0.0))) [caused by: Unable to resolve 4.0: missing requirement [4.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers)])
    org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.exam.extender.service [2]: Unable to resolve 2.0: missing requirement [2.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.6.0)(!(version>=2.0.0))) [caused by: Unable to resolve 4.0: missing requirement [4.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers)]
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3818)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
        at java.lang.Thread.run(Thread.java:745)
    ERROR: Bundle org.ops4j.pax.logging.pax-logging-api [4] Error starting link:classpath:META-INF/links/org.ops4j.pax.logging.api.link (org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.logging.pax-logging-api [4]: Unable to resolve 4.0: missing requirement [4.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers))
    org.osgi.framework.BundleException: Unresolved constraint in bundle org.ops4j.pax.logging.pax-logging-api [4]: Unable to resolve 4.0: missing requirement [4.0] osgi.wiring.package; (osgi.wiring.package=javax.xml.parsers)
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3818)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
        at java.lang.Thread.run(Thread.java:745)
    ERROR: Bundle org.apache.tika.core [6] Error starting file:/C:/Users/Jason/Desktop/FullText/Tika/tika-1.7/tika-bundle/target/test-bundles/tika-core.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.tika.core [6]: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.crypto))
    org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.tika.core [6]: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=javax.crypto)
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3818)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
        at java.lang.Thread.run(Thread.java:745)
    ERROR: Bundle org.apache.tika.bundle [7] Error starting file:/C:/Users/Jason/Desktop/FullText/Tika/tika-1.7/tika-bundle/target/test-bundles/tika-bundle.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.tika.bundle [7]: Unable to resolve 7.0: missing requirement [7.0] osgi.wiring.package; (osgi.wiring.package=javax.crypto))
    org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.tika.bundle [7]: Unable to resolve 7.0: missing requirement [7.0] osgi.wiring.package; (osgi.wiring.package=javax.crypto)
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3818)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
        at java.lang.Thread.run(Thread.java:745)
    

2 个答案:

答案 0 :(得分:5)

宣传回答评论......

我不确定为什么你的构建在该测试中失败,因为它为我和自动构建/测试系统传递。但是......你可能不想做任何一件事!

如果你转到Apache Tika download page,你会看到一个下载最新稳定的Tika Server可运行jar的链接。按照该链接,选择您喜欢的镜像,下载,验证校验和并运行。 Simples!

如果您确实需要从源代码构建Tika服务器(例如,如果您要对其进行更改),您可以通过运行mvn install -DskipTests来跳过单元测试,这将执行没有测试的构建,或者您可以在源结帐的根目录中编辑pom.xml并注释掉行<module>tika-bundle</module>以从构建中排除整个包部分(测试和所有)。如果您只想使用Tika Server,那么您不需要OSGi捆绑包,因此可以安全地跳过它

答案 1 :(得分:3)

当您尝试使用JDK 8构建tika时会发生此错误。有pull request可以解决此问题。