我使用的是Mahout,也就是Mahout在内部使用KMeansDriver。当我使用Eclipse运行时,它工作得很好。
但是当我创建jar ( runnable jar )并运行时,它显示错误
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: rsrc:mahout-core-0.7.jar
at org.apache.hadoop.fs.Path.initialize(Path.java:140)
at org.apache.hadoop.fs.Path.<init>(Path.java:126)
at org.apache.hadoop.mapred.JobClient.configureCommandLineOptions(JobClient.java:657)
at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:761)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:432)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:447)
at org.apache.mahout.clustering.iterator.ClusterIterator.iterateMR(ClusterIterator.java:185)
at org.apache.mahout.clustering.kmeans.KMeansDriver.buildClusters(KMeansDriver.java:229)
at org.apache.mahout.clustering.kmeans.KMeansDriver.run(KMeansDriver.java:149)
at main.java.com.insideview.CompClustering.WorldCompClusteringPrivate.main(WorldCompClusteringPrivate.java:454)
... 5 more
Caused by: java.net.URISyntaxException: Relative path in absolute URI: rsrc:mahout-core-0.7.jar
at java.net.URI.checkPath(URI.java:1804)
at java.net.URI.<init>(URI.java:752)
at org.apache.hadoop.fs.Path.initialize(Path.java:137)
... 14 more你能告诉我为什么会这样吗?我是Mahout和Hadoop中的newbee。
发布于 2014-08-16 09:54:13
问题是Eclipse使用"rsrc:“样式设置了jarfile的依赖项,以便Hadoop尝试加载"rsrc:mahout-core-0.7.jar",但失败了,因为它将"rsrc”解析为Hadoop文件系统的“方案”(通常隐含为"hdfs"),然后将字符串的其余部分解析为该方案中的“相对路径”,而实际上,"rsrc“根本不是Hadoop文件系统方案。
在Eclipse中创建可运行的jarfile时,您应该能够通过启用“将所需的库打包到生成的jar中”选项来解决这个问题。下面是一个类似用户体验的老帖子:
http://lucene.472066.n3.nabble.com/Error-while-running-MapR-program-on-multinode-configuration-td4053610.html
https://stackoverflow.com/questions/22011071
复制相似问题