【问题标题】:Error:osgi:Exception in parsing jar file for extract from jar错误:osgi:解析 jar 文件以从 jar 中提取时出现异常
【发布时间】:2019-09-18 16:08:16
【问题描述】:
  1. 尝试从 intellij 运行应用程序时,出现以下错误:

    错误:osgi:[owlapi-distribution] 解析 jar 文件以从 jar 中提取时出现异常:C:/Users/User/Desktop/taheriDSS/pom.xml java.util.zip.ZipException: JAR/ZIP 文件( C:\Users\User\Desktop\taheriDSS\pom.xml) 似乎已损坏,错误:打开 zip 文件时出错

  2. 如果我从构面中删除 osgi,那么我会遇到一个新错误:

    线程“主”org.semanticweb.owlapi.model.OWLOntologyFactoryNotFoundException 中的异常:找不到合适的工厂从本体文档中加载本体:

顺便说一句,删除.m2 存储库并重新下载没有结果。 pom.xml:

    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <artifactId>owlapi-parent</artifactId>
        <groupId>net.sourceforge.owlapi</groupId>
        <version>5.1.11</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>owlapi-distribution</artifactId>
    <packaging>bundle</packaging>
    <name>OWLAPI :: Distribution</name>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.2.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Implementation-Title>${project.name}</Implementation-Title>
                        <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                        <Implementation-Version>${project.version}.${maven.build.timestamp}</Implementation-Version>
                        <Bundle-SymbolicName>org.semanticweb.owl.owlapi</Bundle-SymbolicName>
                        <Bundle-Version>${project.version}</Bundle-Version>
                        <Embed-Dependency>groupId=${project.groupId};inline=true;scope=compile|runtime|provided</Embed-Dependency>
                        <Embed-Directory>lib</Embed-Directory>
                        <Embed-Transitive>true</Embed-Transitive>
                        <_exportcontents>!org.semanticweb.owlapi.test.*,
                            com.clarkparsia.*,
                            de.uulm.*,
                            org.semanticweb.owlapi.*;-split-package:=merge-first,
                            org.semanticweb.owlapitools.*;-split-package:=merge-first,
                            org.coode.*,
                            uk.ac.manchester.*;-split-package:=merge-first,
                            org.obolibrary.*;-split-package:=merge-first</_exportcontents>
                        <Import-Package>!sun.misc,
                            org.eclipse.rdf4j.*;version="[2.0,3.0)",
                            !javax.annotation,
                            !com.google.inject.internal.*;resolution:=optional,
                            org.apache.commons.io.*;version=2.5,
                            org.apache.commons.logging.*;version=1.2,
                            *</Import-Package>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <artifactSet>
                                <includes>
                                    <include>net.sourceforge.owlapi:owlapi-api</include>
                                    <include>net.sourceforge.owlapi:owlapi-apibinding</include>
                                    <include>net.sourceforge.owlapi:owlapi-impl</include>
                                    <include>net.sourceforge.owlapi:owlapi-oboformat</include>
                                    <include>net.sourceforge.owlapi:owlapi-parsers</include>
                                    <include>net.sourceforge.owlapi:owlapi-rio</include>
                                    <include>net.sourceforge.owlapi:owlapi-tools</include>
                                </includes>
                                <excludes>
                                    <exclude>org.apache.felix:org.osgi.core</exclude>
                                    <exclude>org.eclipse.rdf4j:*</exclude>
                                    <exclude>com.fasterxml.jackson.core:*</exclude>
                                    <exclude>com.github.jsonld-java:*</exclude>
                                    <exclude>com.fasterxml.jackson.core:*</exclude>
                                    <exclude>org.apache.httpcomponents:*</exclude>
                                    <exclude>commons-codec:commons-codec:*</exclude>
                                    <exclude>org.slf4j:*</exclude>
                                    <exclude>org.semarglproject:*</exclude>
                                    <exclude>com.github.ben-manes.caffeine:*</exclude>
                                    <exclude>com.google.guava:*</exclude>
                                    <exclude>com.google.inject:*</exclude>
                                    <exclude>javax.inject:*</exclude>
                                    <exclude>aopalliance:*</exclude>
                                    <exclude>com.google.inject.extensions:*</exclude>
                                    <exclude>com.google.code.findbugs:*</exclude>
                                    <exclude>org.slf4j:slf4j-api</exclude>
                                    <exclude>commons-io:*</exclude>
                                    <exclude>org.tukaani:*</exclude>
                                    <exclude>com.carrotsearch:*</exclude>
                                </excludes>
                            </artifactSet>
                            <transformers>
                                <transformer />
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.4</version>
                <executions>
                    <execution>
                        <id>attach-javadoc</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <skip>${no-javadoc}</skip>
                            <show>public</show>
                            <includeDependencySources>true</includeDependencySources>
                            <dependencySourceIncludes>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-api</dependencySourceInclude>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-apibinding</dependencySourceInclude>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-parsers</dependencySourceInclude>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-tools</dependencySourceInclude>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-impl</dependencySourceInclude>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-oboformat</dependencySourceInclude>
                            </dependencySourceIncludes>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <show>public</show>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <attach>true</attach>
                    <descriptors>
                        <descriptor>src/assembly/sources.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>net.sourceforge.owlapi</groupId>
            <artifactId>owlapi-compatibility</artifactId>
            <version>5.1.11</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.9.9</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.9</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.9.9</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-rdf-api</artifactId>
            <version>0.5.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.tukaani</groupId>
            <artifactId>xz</artifactId>
            <version>1.6</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.22</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.7.22</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-model</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-api</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-languages</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-datatypes</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-binary</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-n3</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-nquads</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-ntriples</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-rdfjson</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-jsonld</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-rdfxml</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-trix</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-turtle</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-trig</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-util</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.github.jsonld-java</groupId>
            <artifactId>jsonld-java</artifactId>
            <version>0.12.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.github.vsonnier</groupId>
            <artifactId>hppcrt</artifactId>
            <version>0.7.5</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.20.0</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>byte-buddy</artifactId>
                    <groupId>net.bytebuddy</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>byte-buddy-agent</artifactId>
                    <groupId>net.bytebuddy</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>objenesis</artifactId>
                    <groupId>org.objenesis</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.github.ben-manes.caffeine</groupId>
            <artifactId>caffeine</artifactId>
            <version>2.6.1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>[18.0,22.0]</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>[2.0.0,4)</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>[1.7.0,1.7.26)</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.github.galigator.openllet</groupId>
            <artifactId>openllet-owlapi</artifactId>
            <version>2.6.4</version>
        </dependency>
        <dependency>
            <groupId>com.github.galigator.openllet</groupId>
            <artifactId>openllet-jena</artifactId>
            <version>2.6.4</version>
        </dependency>
    </dependencies>

    <properties>
        <inherited.rdf4j.version>${rdf4j.version}</inherited.rdf4j.version>
    </properties>
</project>

编辑:删除 pom.xml 后问题解决,重新创建并重新启动 intellij 几次!
看来intellij有问题

【问题讨论】:

  • 看不到 POM 文件很难帮助...
  • youtrack.jetbrains.com/issue/IDEA-113038 存在一个未解决的错误。看看禁用osmorc/osgi插件有没有帮助:jetbrains.com/idea/webhelp/enabling-and-disabling-plugins.html.
  • 您正在显示 OWL API POM 文件 - 我不是这个意思。更有趣的是你如何将它添加到你的项目中......我现在使用 IntelliJ 和 OWL API 依赖项已经很长时间了,从来没有任何问题。所以更多细节会有所帮助(当然除了 CrazyCoder 的错误提示)

标签: java maven intellij-idea owl owl-api


【解决方案1】:

问题不在于 POM 文件,而事实上 IntelliJ 正试图像打开 zip 文件一样打开它。当类路径包含文本文件时,Ant 可能会重现类似的问题。考虑到@CrazyCoder 在上述评论中链接的问题已有六年之久,IDE 似乎不会被修复。

尝试将类路径中的库限制为仅实际的 Jar 文件。这是根本问题。

另一方面,您说“在尝试运行应用程序时” - 但 owlapi-distribution 不是应用程序,它是一个库。没有要运行的主类;因此,您尝试运行的应用程序不会显示在此处。如果没有看到您的应用程序的 pom,我们将无法提供进一步的建议; OWLAPI pom 在这里并不重要。

【讨论】:

    猜你喜欢
    • 2018-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-14
    • 1970-01-01
    • 1970-01-01
    • 2018-04-14
    • 1970-01-01
    相关资源
    最近更新 更多