我正在使用Mahout KMeansDriver,即Mahout在内部使用Hadoop。当我使用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的新手。
答案 0 :(得分:1)
问题是Eclipse使用“rsrc:”样式设置jarfile的依赖项,以便Hadoop尝试加载“rsrc:mahout-core-0.7.jar”,但是因为它将“rsrc”解析为“scheme”而失败Hadoop文件系统(通常这被暗示为“hdfs”),然后字符串的其余部分作为该方案中的“相对路径”,实际上,“rsrc”并不打算成为Hadoop文件系统计划。
在Eclipse中创建runnable jarfile时,您应该能够通过启用“将所需的包打包到生成的jar”选项来解决此问题。这是一个类似用户体验的旧线程: