我想访问hadoop toolrunner类中hive-site.xml的值(即获取hive委托令牌)。
但当我这么做的时候
new HiveConf()
或
new HiveConf(configuration, HiveConf.class)
创建的hiveconf只包含默认值,不包含hive-site.xml中的任何设置
我发现解决方案应该是将/etc/hive/conf添加到hadoop-env.sh中的hadoop_类路径中,但这并没有修复配置值的加载,并且在尝试获取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地址和其他设置的正确方法是什么?