当前位置: 首页 > 知识库问答 >
问题:

错误:osgi:分析jar文件以从jar提取时出现异常

呼延子安
2023-03-14

>

如果我从facets中删除osgi,那么我会遇到一个新的错误:

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

BTW删除。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似乎有问题


共有1个答案

嵇丰
2023-03-14

问题不在于POM文件,而在于IntelliJ试图像打开zip文件一样打开它。当类路径包含一个文本文件时,可以使用Ant重现类似的问题。鉴于@CrazyCoder在上面评论中链接的问题已经存在六年了,IDE似乎不太可能得到修复。

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

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

 类似资料:
  • 运行hadoop jar文件时出现以下错误 线程“main”java中出现异常。lang.ClassNotFoundException:hdfs: 位于java。网URLClassLoader 1美元。在java上运行(URLClassLoader.java:366) 。网URLClassLoader 1美元。在java上运行(URLClassLoader.java:355) 。安全AccessC

  • 我下载了以下链接: http://www.java2s.com/Code/JarDownload/java/java-json.jar.zip 然后,我将jar添加到构建路径:右键单击项目 我能够使用java-json库而不会出现任何错误。然而,当我将项目导出到一个jar时,没有选项将java-json引用库作为jar的一部分。所以我假设通过将库添加到构建路径,我不必导出外部罐(无论如何也没有选项

  • 以下是从Java Archive(jar)文件中提取内容和元数据的程序 - import java.io.File; import java.io.FileInputStream; import java.io.IOException; import org.apache.tika.exception.TikaException; import org.apache.tika.metadata.

  • 我正在使用IntelliJ IDEA从LeanFT项目创建一个jar工件。 jar工件已生成,但带有以下错误消息: 发生JNI错误,请检查您的安装并重试 当试图直接执行jar文件时。 当我使用IDE执行时,它正在工作。不需要任何参数或参数值。当我从简单的“你好世界”生成一个jar文件时,我收到同样的错误。 堆栈跟踪:

  • null 这里出了什么问题。

  • 问题内容: 我需要以编程方式计算给定jar文件中已编译类,接口和枚举的数量(因此我需要三个单独的数字)。哪个API对我有帮助?(我不能使用第三方库。) 我已经尝试过非常棘手的方案,这似乎并不总是正确的。即,我将每个ZipEntry读入byte [],然后将结果提供给我的自定义类加载器,该加载器扩展了标准CalssLoader并将此byte []发送到ClassLoader.defineClass(