【问题标题】:why I cannot read a big data file in java?为什么我无法在 java 中读取大数据文件?
【发布时间】:2019-04-16 05:03:17
【问题描述】:

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

    [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)

请帮忙

【问题讨论】:

  • 请让我们看看你的 pom.xml 和你的 Java 代码。
  • @PowerStat 请检查代码。注意到对于小文件,它工作得很好
  • 我认为你的 pom 会更有趣,因为它使用了 exec-maven-plugin - 它报告了错误。
  • 一个快速的谷歌搜索出现了this

标签: java maven


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-23
    • 2020-08-11
    • 1970-01-01
    • 2020-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-02
    相关资源
    最近更新 更多