我一名coder,最新刚刚学习hive。在网上找了一个安装hive的文章,但是安装完之后启动hive 总是报一个错误(这个错误我解决了一周 nnd 太笨 shit )今天我终于把他给搞定了,还是请教了一位网上的友人。非常感谢他给提供的思路。下面是错误的信息和解决方法。
Logging initialized using configuration in jar:file:/soft/temp/hive-0.11.0/lib/hive-common-0.11.0.jar!/hive-log4j.properties
Hive history file=/tmp/root/hive_job_log_root_21574@tadu-memcache_201406171817_1129279715.txt
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.hadoop.hive.cli.CliDriver.getCommandCompletor(CliDriver.java:530)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:722)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.RunJar.main(RunJar.java:160)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:115)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerGenericUDF(FunctionRegistry.java:504)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerGenericUDF(FunctionRegistry.java:498)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.<clinit>(FunctionRegistry.java:288)
... 8 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:113)
... 11 more
Caused by: java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: No XPathFctory implementation found for the object model: http://java.sun.com/jaxp/xpath/dom
at javax.xml.xpath.XPathFactory.newInstance(Unknown Source)
at org.apache.hadoop.hive.ql.udf.xml.UDFXPathUtil.<init>(UDFXPathUtil.java:41)
at org.apache.hadoop.hive.ql.udf.xml.GenericUDFXPath.<init>(GenericUDFXPath.java:53)
... 16 more
错误如上,其实解决这个问题比较简单就是把jdk下jre/lib/endorsed/xercesImpl.jar和xml-apis.jar这两个文件给删除就可以。原因就是jar包冲突造成的。其实用到hive 的其它版本也会报这样类似的错误,我就不把所有的错误都罗列了。希望遇到这个错误的同学用这个办法解决。