为什么我无法在Java中读取大数据文件?

时间:2019-04-16 05:03:18

标签: java maven

我的程序编译没有任何错误。但是执行大文件时,出现以下异常:

    [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project rdf4j-getting-started: 
    An exception occured while executing the Java class. null: InvocationTargetException: The parser has encountered
 more than "100,000" entity expansions in this document; this is the limit imposed by the application. -> [Help 1]

我正在使用以下命令:

mvn -Djdk.xml.totalEntitySizeLimit=0 -DentityExpansionLimit=0  exec:java

我的pom具有所有依赖性:

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.example</groupId>
  <artifactId>rdf4j-getting-started</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>HelloRDF4J</name>
  <dependencies>
    <dependency>
        <groupId>org.eclipse.rdf4j</groupId>
        <artifactId>rdf4j-runtime</artifactId>
        <version>2.0M2</version>
    </dependency>

  </dependencies>
  <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>utf8</encoding>
            </configuration>
        </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>ConvertOntology</mainClass>
                    </configuration>
            </plugin>
    </plugins>
</build>
</project>

我使用以下Java版本:

java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)

请帮忙

1 个答案:

答案 0 :(得分:1)

我的命令是正确的。我通过添加到pom文件解决了这个问题:

<dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.0.13</version>
    </dependency>