代码之家  ›  专栏  ›  技术社区  ›  Honza

new hiveconf()不加载hive-site.xml

  •  0
  • Honza  · 技术社区  · 7 年前

    我想访问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地址和其他设置的正确方法是什么?

    0 回复  |  直到 7 年前