hadoop java.net.URISyntaxException:绝对URI中的相对路径:rsrc:hbase-common-0.98.1-hadoop2.jar
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25334604/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
hadoop java.net.URISyntaxException: Relative path in absolute URI: rsrc:hbase-common-0.98.1-hadoop2.jar
提问by ihate3putts
I have a map reduce job that connects to HBASE and I can't figure out where I am running into this error:
我有一个连接到 HBASE 的 map reduce 作业,但我不知道我在哪里遇到了这个错误:
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)
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.apache.hadoop.util.RunJar.main(RunJar.java:212)
Caused by: java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: rsrc:hbase-common-0.98.1-hadoop2.jar
at org.apache.hadoop.fs.Path.initialize(Path.java:206)
at org.apache.hadoop.fs.Path.<init>(Path.java:172)
at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.findOrCreateJar(TableMapReduceUtil.java:703)
at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.addDependencyJars(TableMapReduceUtil.java:656)
at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.addHBaseDependencyJars(TableMapReduceUtil.java:573)
at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.addDependencyJars(TableMapReduceUtil.java:617)
at org.apache.hadoop.hbase.mapreduce.HFileOutputFormat2.configureIncrementalLoad(HFileOutputFormat2.java:398)
at org.apache.hadoop.hbase.mapreduce.HFileOutputFormat2.configureIncrementalLoad(HFileOutputFormat2.java:356)
at com.ancestry.bigtree.hfile.JsonToHFileDriver.run(JsonToHFileDriver.java:117)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at com.ancestry.bigtree.hfile.JsonToHFileDriver.main(JsonToHFileDriver.java:69)
... 10 more
Caused by: java.net.URISyntaxException: Relative path in absolute URI: rsrc:hbase-common-0.98.1-hadoop2.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:203)
If I don't have Hbase libraries, the job runs fine. Where is the relative path being generated? How can I force the generated paths to be absolute?
如果我没有 Hbase 库,则作业运行良好。生成的相对路径在哪里?如何强制生成的路径是绝对的?
In my code I have these two lines:
在我的代码中,我有这两行:
TableMapReduceUtil.addHBaseDependencyJars(conf); HFileOutputFormat2.configureIncrementalLoad(job, htable);
TableMapReduceUtil.addHBaseDependencyJars(conf); HFileOutputFormat2.configureIncrementalLoad(job, htable);
if I remove them I am ok but the job does not do what I need it to do. I am ultimately trying to create HFILE to use with hbase bulkloader.
如果我删除它们,我就可以了,但是这份工作没有做我需要做的事情。我最终试图创建 HFILE 以与 hbase bulkloader 一起使用。
Environment: HBase 0.96.1.2.0.10.0-1-hadoop2 Hadoop 2.2.0.2.0.10.0-1
环境:HBase 0.96.1.2.0.10.0-1-hadoop2 Hadoop 2.2.0.2.0.10.0-1
Thank you in advance for any help or direction.
提前感谢您的任何帮助或指导。
回答by Dennis Huo
The exception is a bit misleading; there's no real relative path being parsed, the issue here is that Hadoop "Path" doesn't support ':' in filenames. In your case, "rsrc:hbase-common-0.98.1-hadoop2.jar" is being interpreted as "rsrc" being the "scheme", whereas I suspect you really intended to add the resource file:///path/to/your/jarfile/rsrc:hbase-common-0.98.1-hadoop2.jar". Here's an old JIRA discussing the illegal character:
这个例外有点误导。没有解析真正的相对路径,这里的问题是 Hadoop“路径”不支持文件名中的“:”。在你的情况下,“rsrc:hbase-common-0.98.1-hadoop2.jar”被解释为“rsrc”是“scheme”,而我怀疑你真的打算添加资源 file:///path/to /your/jarfile/rsrc:hbase-common-0.98.1-hadoop2.jar”。这是一个讨论非法字符的旧 JIRA:
https://issues.apache.org/jira/browse/HADOOP-3257
https://issues.apache.org/jira/browse/HADOOP-3257
Note that you probably won't be able use that absolute path either, since it still has ':' in the filename. You can try escaping the filename like "rsrc%3Ahbase-common-0.98.1-hadoop2.jar", but then it may not be found correctly on the other end where it is being used either.
请注意,您可能也无法使用该绝对路径,因为它的文件名中仍有“:”。您可以尝试转义文件名,例如“rsrc%3Ahbase-common-0.98.1-hadoop2.jar”,但是在使用它的另一端可能无法正确找到它。
The best way to fix this is to tackle the root cause of "rsrc:hbase-common-0.98.1-hadoop2.jar" being introduced--using Eclipse to build your runnable jar is one likely cause of the issue. If possible, try to build your jar using something other than Eclipse and see if the same problem occurs; you can also try to select "Package required libraries into generated jar" when creating your jar in Eclipse.
解决此问题的最佳方法是解决引入“rsrc:hbase-common-0.98.1-hadoop2.jar”的根本原因——使用 Eclipse 构建可运行的 jar 是导致该问题的一个可能原因。如果可能,请尝试使用 Eclipse 以外的其他工具构建您的 jar,看看是否会出现同样的问题;在 Eclipse 中创建 jar 时,您也可以尝试选择“将所需的库打包到生成的 jar 中”。
If the uber-jar ends up too large, you can also try to place the original dependency jars like hbase-common-0.98.1-hadoop2.jar into the classpath on all your nodes along with any other dependencies you may need, and then skip the call to "TableMapReduceUtil.addHBaseDependencyJars(conf);".
如果 uber-jar 最终太大,您还可以尝试将像 hbase-common-0.98.1-hadoop2.jar 这样的原始依赖项 jar 连同您可能需要的任何其他依赖项一起放入所有节点的类路径中,然后跳过对“TableMapReduceUtil.addHBaseDependencyJars(conf);”的调用。
Here's an old thread of another user running into a similar problem as what you're seeing:
这是另一个用户遇到与您所看到的类似问题的旧线程: