hadoop 2.4 maven build outofmemoryerror:java堆空间

lnvxswe2  于 2021-05-30  发布在  Hadoop
关注(0)|答案(2)|浏览(367)

我试图在我的mac上构建完整的hadoop源代码。当我尝试构建时,我经常遇到错误:“java.lang.outofmemoryerror:java heap space”。我尝试使用以下命令设置maven opts:export maven\u opts=“-xms256m-xmx1024m”和export maven\u opts=“-xmx2g-xx:maxpermsize=512m-xx:reservedcodecachesize=512m”。但这些解决方案都没有帮助我。我有一个4gb的ddr3内存。2.3 ghz intel core i5处理器。请告诉我正确的方向。日志:

[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Hadoop HDFS 2.4.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ hadoop-hdfs ---
[INFO] Deleting /Users/harshavyaspalli/Sachin/hadoop/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/target
[INFO] 
[INFO] --- maven-antrun-plugin:1.7:run (create-testdirs) @ hadoop-hdfs ---
[INFO] Executing tasks

main:
    [mkdir] Created dir: /Users/harshavyaspalli/Sachin/hadoop/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/target/test-dir
    [mkdir] Created dir: /Users/harshavyaspalli/Sachin/hadoop/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/target/test/data
[INFO] Executed tasks
[INFO] 
[INFO] --- maven-antrun-plugin:1.7:run (create-jsp-generated-sources-directory) @ hadoop-hdfs ---
[INFO] Executing tasks

main:
    [mkdir] Created dir: /Users/harshavyaspalli/Sachin/hadoop/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/target/generated-sources/java
[INFO] Executed tasks
[INFO] 
[INFO] --- jspc-maven-plugin:2.0-alpha-3:compile (hdfs) @ hadoop-hdfs ---
[WARNING] Compiled JSPs will not be added to the project and web.xml will not be modified, either because includeInProject is set to false or because the project's packaging is not 'war'.
Created dir: /Users/harshavyaspalli/Sachin/hadoop/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/target/classes
[INFO] Compiling 8 JSP source files to /Users/harshavyaspalli/Sachin/hadoop/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/target/generated-sources/java
[INFO] Built File: /block_info_xml.jsp
[INFO] Built File: /corrupt_files.jsp
[INFO] Built File: /corrupt_replicas_xml.jsp
[INFO] Built File: /decommission.jsp
[INFO] Built File: /dfsclusterhealth.jsp
[INFO] Built File: /dfshealth.jsp
[INFO] Built File: /dfsnodelist.jsp
[INFO] Built File: /nn_browsedfscontent.jsp
WARN: The method class org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
WARN: Please see http://www.slf4j.org/codes.html for an explanation.
[INFO] Compiled completed in 0:00:00.579
[INFO] 
[INFO] --- jspc-maven-plugin:2.0-alpha-3:compile (secondary) @ hadoop-hdfs ---
[WARNING] Compiled JSPs will not be added to the project and web.xml will not be modified, either because includeInProject is set to false or because the project's packaging is not 'war'.
[INFO] Compiling 1 JSP source file to /Users/harshavyaspalli/Sachin/hadoop/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/target/generated-sources/java
[INFO] Built File: /status.jsp
WARN: The method class org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
WARN: Please see http://www.slf4j.org/codes.html for an explanation.
[INFO] Compiled completed in 0:00:00.041
[INFO] 
[INFO] --- jspc-maven-plugin:2.0-alpha-3:compile (journal) @ hadoop-hdfs ---
[WARNING] Compiled JSPs will not be added to the project and web.xml will not be modified, either because includeInProject is set to false or because the project's packaging is not 'war'.
[INFO] Compiling 1 JSP source file to /Users/harshavyaspalli/Sachin/hadoop/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/target/generated-sources/java
[INFO] Built File: /journalstatus.jsp
WARN: The method class org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
WARN: Please see http://www.slf4j.org/codes.html for an explanation.
[INFO] Compiled completed in 0:00:00.041
[INFO] 
[INFO] --- jspc-maven-plugin:2.0-alpha-3:compile (datanode) @ hadoop-hdfs ---
[WARNING] Compiled JSPs will not be added to the project and web.xml will not be modified, either because includeInProject is set to false or because the project's packaging is not 'war'.
[INFO] Compiling 4 JSP source files to /Users/harshavyaspalli/Sachin/hadoop/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/target/generated-sources/java
[INFO] Built File: /browseBlock.jsp
[INFO] Built File: /browseDirectory.jsp
[INFO] Built File: /dataNodeHome.jsp
[INFO] Built File: /tail.jsp
WARN: The method class org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
WARN: Please see http://www.slf4j.org/codes.html for an explanation.
[INFO] Compiled completed in 0:00:00.073
[INFO] 
[INFO] --- build-helper-maven-plugin:1.5:add-source (add-jsp-generated-sources-directory) @ hadoop-hdfs ---
[INFO] Source directory: /Users/harshavyaspalli/Sachin/hadoop/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/target/generated-sources/java added.
[INFO] 
[INFO] --- hadoop-maven-plugins:2.4.0:protoc (compile-protoc) @ hadoop-hdfs ---
[WARNING] [protoc, --version] failed with error code 1
[INFO] 
[INFO] --- hadoop-maven-plugins:2.4.0:protoc (compile-protoc-datanode) @ hadoop-hdfs ---
[WARNING] [protoc, --version] failed with error code 1
[INFO] 
[INFO] --- hadoop-maven-plugins:2.4.0:protoc (compile-protoc-namenode) @ hadoop-hdfs ---
[WARNING] [protoc, --version] failed with error code 1
[INFO] 
[INFO] --- hadoop-maven-plugins:2.4.0:protoc (compile-protoc-qjournal) @ hadoop-hdfs ---
[WARNING] [protoc, --version] failed with error code 1
[INFO] 
[INFO] --- maven-resources-plugin:2.2:resources (default-resources) @ hadoop-hdfs ---
[INFO] Using default encoding to copy filtered resources.
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ hadoop-hdfs ---
[INFO] Compiling 587 source files to /Users/harshavyaspalli/Sachin/hadoop/hadoop-2.4.0-src/hadoop-hdfs-project/hadoop-hdfs/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:

The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
    at com.sun.tools.javac.util.Position$LineMapImpl.build(Position.java:139)
    at com.sun.tools.javac.util.Position.makeLineMap(Position.java:63)
    at com.sun.tools.javac.parser.Scanner.getLineMap(Scanner.java:1113)
    at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:512)
    at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:550)
    at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:804)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
    at com.sun.tools.javac.main.Main.compile(Main.java:353)
    at com.sun.tools.javac.main.Main.compile(Main.java:279)
    at com.sun.tools.javac.main.Main.compile(Main.java:270)
    at com.sun.tools.javac.Main.compile(Main.java:87)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess0(JavacCompiler.java:551)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:526)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:167)
    at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:678)
    at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)

[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Apache Hadoop Main ................................ SUCCESS [  3.836 s]
[INFO] Apache Hadoop Project POM ......................... SUCCESS [  1.634 s]
[INFO] Apache Hadoop Annotations ......................... SUCCESS [  3.661 s]
[INFO] Apache Hadoop Assemblies .......................... SUCCESS [  0.441 s]
[INFO] Apache Hadoop Project Dist POM .................... SUCCESS [  2.310 s]
[INFO] Apache Hadoop Maven Plugins ....................... SUCCESS [  4.806 s]
[INFO] Apache Hadoop MiniKDC ............................. SUCCESS [  4.093 s]
[INFO] Apache Hadoop Auth ................................ SUCCESS [  4.638 s]
[INFO] Apache Hadoop Auth Examples ....................... SUCCESS [  2.795 s]
[INFO] Apache Hadoop Common .............................. SUCCESS [01:38 min]
[INFO] Apache Hadoop NFS ................................. SUCCESS [ 11.257 s]
[INFO] Apache Hadoop Common Project ...................... SUCCESS [  0.051 s]
[INFO] Apache Hadoop HDFS ................................ FAILURE [ 15.643 s]
[INFO] Apache Hadoop HttpFS .............................. SKIPPED
[INFO] Apache Hadoop HDFS BookKeeper Journal ............. SKIPPED

谢谢和问候。

xytpbqjk

xytpbqjk1#

这个错误是由maven编译器插件抛出的,编辑你正在构建的pom文件,在属性maven编译器插件添加下面的配置

<configuration>
 <verbose>true</verbose>
 <fork>true</fork>
 </configuration>

这将清除堆空间错误。

y0u0uwnf

y0u0uwnf2#

对于mac/linux用户,只需在~/.profile(或类似文件名)中添加一个export语句。例如:

export MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m"

重新启动shell。为我工作

相关问题