我想从我的hadoop ToolRunner类中的hive-site.xml中访问值(即获取hive委托令牌)。
但是当我执行new HiveConf()
或new HiveConf(configuration, HiveConf.class)
时,创建的HiveConf仅包含默认设置,而没有hive-site.xml中的任何设置
我发现提到解决方案应该是将/ etc / hive / conf添加到hadoop-env.sh中的HADOOP_CLASSPATH中,但这不能解决配置值的加载问题,并在尝试获取时导致异常JDBC HiveConnection。
Caused by: org.datanucleus.exceptions.NucleusUserException: Persistence process has been specified to use a ClassLoaderResolver of name "datanucleus" yet this has not been found by the DataNucleus plugin mechanism. Please check your CLASSPATH and plugin specification.
at org.datanucleus.NucleusContext.<init>(NucleusContext.java:283)
at org.datanucleus.NucleusContext.<init>(NucleusContext.java:247)
at org.datanucleus.NucleusContext.<init>(NucleusContext.java:225)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.<init>(JDOPersistenceManagerFactory.java:416)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:301)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:202)
几乎似乎在类路径上需要更多配置单元代码,但缺少。
找出HiveServer2地址和其他设置的正确方法是什么?