HBase报错解决【Caused by java.net.URISyntaxException Relative path in absolute URI rsrchbase-common-1.0.0
来源:互联网 发布:淘宝psn点卡 编辑:程序博客网 时间:2024/06/05 07:00
1问题标题:运行hadoop jar t1.jar操作,hbase数据库报错:
Caused by: java.net.URISyntaxException:Relative path in absolute URI: rsrc:hbase-common-1.0.0-cdh5.5.0.jar
这个问题好苦恼的,好好的jar不能运行。到底是哪里出问题了,很奇怪!!
2前置条件:
hadoop运行jar代码无错误,使用eclipse自动的runnable打包,问题就在这。为什么呢??
3问题重现:
[root@wycoldb01 opt]# hadoop jar t1.jar
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [rsrc:org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:rsrc:avro-tools-1.7.6-cdh5.5.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
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.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: rsrc:hbase-common-1.0.0-cdh5.5.0.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:848)
at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.addDependencyJars(TableMapReduceUtil.java:802)
at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.addHBaseDependencyJars(TableMapReduceUtil.java:719)
at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.addDependencyJars(TableMapReduceUtil.java:763)
at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.java:213)
at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.java:169)
at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.java:292)
at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.java:93)
at com.tydic.storm.hbase.importhbase.ParseListPutDriver.main(ParseListPutDriver.java:129)
... 11 more
Caused by: java.net.URISyntaxException: Relative path in absolute URI: rsrc:hbase-common-1.0.0-cdh5.5.0.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)
... 21 more
4原因分析:
以下是国外一篇文章分析:
http://stackoverflow.com/questions/25334604/hadoop-java-net-urisyntaxexception-relative-path-in-absolute-uri-rsrchbase-co
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:
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.
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.
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);".
Here's an old thread of another user running into a similar problem as what you're seeing:
http://lucene.472066.n3.nabble.com/Error-while-running-MapR-program-on-multinode-configuration-td4053610.html
他说path路径不支持“:”,应该使用相对路径,而不是绝对路径,运行时认为他是rsrc的东东
...
...
...
使用Eclipse构建可运行jar(同时引入了jar包)是一个问题的可能的原因。
5解决方案:
使用extract 这种打包方式,不要选择package的方式打runnable的jar包。
一种是把lib作为class-path加入到manifset中运行主类找包。(一般使用这种打包)
另外一种使用的是提取lib中jar包中的class文件打包。(在这里使用这种打包)
解决方案:
使用extract提取class打runnable包
另外,笔者还有另外一种解决方案的想法:
使用maven打包或者第三方打包工具(待尝试)。由于这里依赖了hbase和storm的新的包,中央仓库还没有,也没建私有仓库,要求又必须打包到jar中,不好打包,所以没法打包。如果有打包成功的,分享下maven的配置,谢谢。
- HBase报错解决【Caused by java.net.URISyntaxException Relative path in absolute URI rsrchbase-common-1.0.0
- Spark2.0的Caused by: java.net.URISyntaxException: Relative path in absolute URI: file错误
- Spark代码调试遇到的错误Caused by: java.net.URISyntaxException: Relative path in absolute URI: file:
- java.net.URISyntaxException: Relative path in absolute URI
- hive启动报错 java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7B
- hive启动报错 java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7B
- hive启动报错 java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7B
- Spark2.0异常:java.net.URISyntaxException: Relative path in absolute URI
- Hive启动时,遇到java.net.URISyntaxException: Relative path in absolute URI
- Hive 启动异常: java.net.URISyntaxException: Relative path in absolute URI:
- Spark:java.net.URISyntaxException: Relative path in absolute URI: file:D:/XXX/spark-spark-warehouse
- Why does Spark report “java.net.URISyntaxException: Relative path in absolute URI” when working with
- spark 2.0 遇到java.net.URISyntaxException: Relative path in absolute URI
- hive异常 java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7
- Spark2.0在本地运行时报错URISyntaxException: Relative path in absolute URI: file:G:/code/VersionTest/spark-wa
- Hive启动时,报错Relative path in absolute URI: ${system:java.io.tmpdir}
- httpclient GET方式请求报Caused by: java.net.URISyntaxException
- Spark命令行测试转换RDD to DataFrame报Relative path in absolute URI错误-Win7
- Editplus最佳配色方案
- Android Framework 记录之一
- LeetCode总结
- java 结构型模式
- 位图的简单处理
- HBase报错解决【Caused by java.net.URISyntaxException Relative path in absolute URI rsrchbase-common-1.0.0
- 从0开始学习OC程序-第9天
- GitHub简单使用
- HTML5学习笔记(总结提炼版)——002 CSS
- 浅谈Javaweb经典三层架构和MVC框架模式
- %cd%与%~dp0的区别
- linux-svn配置笔记
- Android 进程常驻(2)----细数利用android系统机制的保活手段
- 数据结构/算法 - 桶排序