1

TLDR:我更新到 Java 11 和最新的 Maven,但 Maven 有问题。起初,它没有足够的内存来启动 JVM。当内存增加> 1.5 G时,它说它不能分配元空间。将内存减少到 1.2 G 左右,会出现链接错误。在这里做什么?

详细信息:有时它会抱怨某些 Google 库的非法反射而不是链接错误,尽管错误消息似乎取决于我尝试事物的顺序并且很难准确重现。

这是一种情况下的确切输出:

>export MAVEN_OPTS="-Xmx1600m"
>mvn -version
Error occurred during initialization of VM
Could not allocate metaspace: 1073741824 bytes
>export MAVEN_OPTS="-Xmx1000m"
>mvn -version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T14:33:14-04:00)
Maven home: /usr/local/apache-maven-3.5.4
Java version: 11, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-38-generic", arch: "amd64", family: "unix"
>mvn install
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 48192 bytes for Chunk::new
# An error report file with more information is saved as:
# /home/zach/sync_docs/fs/runner/hs_err_pid5590.log
[thread 5617 also had an error]
#
# Can't open file to dump replay data. Error: Not enough space
>export MAVEN_OPTS="-Xmx1200m"
>mvn install
Error: LinkageError occurred while loading main class org.codehaus.plexus.classworlds.launcher.Launcher
    java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-11-openjdk-amd64/lib/libnio.so: /usr/lib/jvm/java-11-openjdk-amd64/lib/libnio.so: failed to map segment from shared object

进一步的输出:

>echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64/

操作系统:Ubuntu 18.04.1 如果我要求它编译 Java 8 JAR,它甚至都无法工作,尽管有时它会开始尝试并很快失败。javac成功编译了一个hello world程序,java成功运行。使用 update-alternatives 切换回 Java 8(java-8-openjdk 或 java-8-oracle,以防它们不同)修复了该问题(但没有 Java 11 功能)。

<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.boydwebb</groupId>
    <artifactId>familysearch</artifactId>
    <version>1.0-SNAPSHOT</version>

    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.compiler.version>1.8</java.compiler.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <version>3.3</version>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.compiler.version}</source>
                    <target>${java.compiler.version}</target>
                </configuration>
</plugin>
<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <finalName>graph-runner</finalName>
        <appendAssemblyId>true</appendAssemblyId>
        <archive>
            <manifest>
                <mainClass>org.boydwebb.familysearch.runner.Runner</mainClass>
            </manifest>
        </archive>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>
    </plugins>
  </build>

  <dependencies>
      <!-- unimi dependencies
     the unimi project versions MUST be as shown here -->
    <dependency>
        <groupId>it.unimi.dsi</groupId>
        <artifactId>webgraph</artifactId>
        <version>3.6.1</version>
    </dependency>

    <dependency>
        <groupId>it.unimi.dsi</groupId>
        <artifactId>sux4j</artifactId>
        <version>4.3.0</version>
    </dependency>

    <dependency>
        <groupId>it.unimi.dsi</groupId>
        <artifactId>fastutil</artifactId>
        <version>8.2.2</version>
    </dependency>

    <dependency>
        <groupId>it.unimi.dsi</groupId>
        <artifactId>dsiutils</artifactId>
        <version>2.5.4</version>
    </dependency>

    <!-- required for runner utilities -->
    <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-core</artifactId>
        <version>1.2.1</version>
    </dependency>

    <!-- logging -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>log4j-over-slf4j</artifactId>
        <version>1.8.0-beta2</version>
    </dependency>

    <!-- command line option parsing -->
    <dependency>
        <groupId>net.sf.jopt-simple</groupId>
        <artifactId>jopt-simple</artifactId>
        <version>6.0-alpha-2</version>
    </dependency>
    <dependency>
        <groupId>org.jetbrains</groupId>
        <artifactId>annotations</artifactId>
        <version>16.0.3</version>
        <scope>compile</scope>
    </dependency>

    <!-- hdf5 -->
    <!--<dependency>
        <groupId>org.hdfgroup</groupId>
        <artifactId>hdf-java</artifactId>
        <version>2.6.1</version>
        <type>jar</type>
    </dependency>-->
    <dependency>
        <groupId>HDF_Group</groupId>
        <artifactId>HDFJava</artifactId>
        <version>3.3.2</version>
        <type>jar</type>
    </dependency>


  </dependencies>
</project>
4

0 回答 0