本文主要是介绍解决ES-Hadoop打包报错“Mkdirs failed to create /var/folders...”问题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、报错问题
在mac下运行ES-Hadoop项目,报错如下:
Bee:eshadoop bee$ hadoop jar target/eshadoop-1.0-SNAPSHOT-jar-with-dependencies.jar /work/blog.json
Exception in thread "main" java.io.IOException: Mkdirs failed to create /var/folders/36/84ywbb7j5kx1jysq1zk9rlzh0000gn/T/hadoop-unjar965332053308521935/META-INF/licenseat org.apache.hadoop.util.RunJar.ensureDirectory(RunJar.java:128)at org.apache.hadoop.util.RunJar.unJar(RunJar.java:104)at org.apache.hadoop.util.RunJar.unJar(RunJar.java:81)at org.apache.hadoop.util.RunJar.run(RunJar.java:209)at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
二、解决
原因是:
zip -d target/eshadoop-1.0-SNAPSHOT-jar-with-dependencies.jar META-INF/LICENSE
附打包插件:
<plugins><plugin><artifactId>maven-assembly-plugin</artifactId><configuration><archive><manifest><mainClass>com.tsinghua.HdfsToEs</mainClass></manifest></archive><descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef></descriptorRefs></configuration><executions><execution><id>make-assembly</id><phase>package</phase><goals><goal>single</goal></goals></execution></executions></plugin><plugin> <groupId>org.apache.maven.plugins</groupId><artifactId>maven-shade-plugin</artifactId><version>3.0.0</version><executions><execution><phase>package</phase><goals><goal>shade</goal></goals><configuration><transformers><transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"><mainClass>com.tsinghua.HdfsToEs</mainClass></transformer><transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"></transformer></transformers></configuration></execution></executions></plugin></plugins>
参考:https://stackoverflow.com/questions/10522835/hadoop-java-io-ioexception-mkdirs-failed-to-create-some-path
这篇关于解决ES-Hadoop打包报错“Mkdirs failed to create /var/folders...”问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!