本文解决的问题首先适用于如下人群:在mac上开发hadoop程序,并且适用maven来管理项目的广大程序猿们,如果你问题不适合该环境,可以绕道而行,当然如果你有兴趣阅读本文,欢迎。
我想在mac上玩hadoop或者研究开发hadoop的果粉来说,碰见这个问题,一定让你很头大。用maven打的可执行jar包,在linux上运行的好好的,但是在mac上就是不行,并且报的错误如下:
Exception in thread "main" java.io.IOException: Mkdirs failed to create /Users/chengdedeng/work/hadoop-0.21.0/myspace/hadooptmp/hadoop-unjar5053508897247834450/license
看到这个错误之后你刚开始觉得很简单,难道没有权限,那告诉你吧,你的想法是错误的。
当然我的命令用的是hadoop jar ***.jar了,因为我打的是可执行的jar包,所以不需要输入后面的参数,这个不多说。为什么会出现这样的错误呢?首先得必须说一下hadoop jar的运行机制,他会自动解压jar包,然后执行你的main函数,解压的过程中不能创建license这个文件夹,因此出现问题。那是不是hadoop的问题呢?肯定不是,因为在linux服务器上可以运行,在mac上不能运行,说明hadoop不存在问题。所以只可能是maven打的jar包出现问题,不多说废话,直接上打可执行jar包的代码吧!
<!--打可执行的jar包,如果使用了IOC容器,需要下面的配置-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<!--woodstox includes a "LICENSE" file in its jar root that conflicts with the "license"
directory on case-insensitive file systems-->
<!--<filter>-->
<!--<artifact>org.codehaus.woodstox:wstx-lgpl</artifact>-->
<!--<excludes>-->
<!--<exclude>LICENSE</exclude>-->
<!--</excludes>-->
<!--</filter>-->
<!--remove signature files-->
<!--<filter>-->
<!--<artifact>*:*</artifact>-->
<!--<excludes>-->
<!--<exclude>META-INF/*.SF</exclude>-->
<!--<exclude>META-INF/*.DSA</exclude>-->
<!--<exclude>META-INF/*.RSA</exclude>-->
<!--<exclude>license/*</exclude>-->
<!--</excludes>-->
<!--</filter>-->
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.ddmap.hadoop.db.mapreduce.cityofuser.Main</mainClass>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
碰见该问题是只需要放开我注销的那部分就ok了,如果还有问题,可以mail我。
邮箱:mapserver000@gmail.com
参考文章:https://issues.apache.org/jira/browse/MAHOUT-780
https://github.com/wpm/Hadoop-GATE/blob/master/pom.xml
分享到:
相关推荐
官方版本,亲测可用
完全可以根据github的要求来配置,我只是没分了~ 官网地址:https://github.com/magro/memcached-session-manager/wiki/SetupAndConfiguration#add-memcached-session-manager-jars-to-tomcat
官方版本,亲测可用
官方版本,亲测可用
官方版本,亲测可用
官方版本,亲测可用
官方版本,亲测可用
官方版本,亲测可用
jars_20221025.tar jars_20221025.tar
hibernate-jars hibernate-jars hibernate-jars
最新版的Cloudsim 仿真平台 已支持容器云平台仿真。主要功能特点: *支持大型云计算数据中心的建模和仿真 *支持虚拟化服务器主机的建模和仿真,以及为虚拟机配置主机资源的可定制策略 *支持应用程序容器的建模和...
官方版本,亲测可用
spring-mongodb-jars
Place libs/DraggableGridView.jar into your project's directory and add it to the build path (http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)) Add an import to the activity ...
jmock-1.2.0-jars.rar
学习spring所需要的jars c3p0-0.9.1.jar com.springsource.net.sf.cglib-2.2.0.jar com.springsource.org.aopalliance-1.0.0.jar com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar commons-logging-...
jMock利用mock objects思想来对Java code进行测试。jMock具有以下特点:容易扩展,让你快速简单地定义mock objects,因此不必打破程序间的关联,让你定义灵活的超越对象之间交互作用而带来测试局限,减少你测试地脆弱...
ognl-3.0-jars.zip
java需要的控件,struts1.2,内含有很多jar文件,在网上找不到合适资源的话可以,方便大家下载使用
jmock-2.6.0-RC2-jars.rar