【问题标题】:using hive got exception java.lang.NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning使用 hive 得到异常 java.lang.NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning
【发布时间】:2020-09-14 12:32:36
【问题描述】:

配置hadoop之后 我可以运行 hdfs

然后安装 hive 并编辑 conf 文件使其默认在 tez 上运行, 但是直接使用 hive 会遇到一些特殊问题:

蜂巢

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tez/dag/api/SessionNotRunning
        at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:353)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625)
        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:212)

版本信息: Hadoop:2.5 蜂巢 0.13 tez 0.41

有人遇到过这个吗?

似乎不是 PATH 相关的错误。

【问题讨论】:

    标签: java hadoop hive


    【解决方案1】:

    我的问题是:

    Could not open connection to jdbc:hive2://localhost:10000: java.net.ConnectException: Connection refused (state=08S01,code=0)
    

    这是我的解决方案以及解决的进度:

    当运行以下命令启动 hiveserver2

    hive --service hiveserver2
    

    日志告诉异常:

        Error starting HiveServer2 on attempt 1, will retry in 60000ms
    java.lang.NoClassDefFoundError: org/apache/tez/dag/api/TezConfiguration
    

    但继续查找我们发现

    2018-11-16T18:45:14,836  INFO [main] server.HiveServer2: HS2 interactive HA not enabled. Starting tez sessions..
    2018-11-16T18:45:14,836  INFO [main] server.HiveServer2: Starting/Reconnecting tez sessions..
    

    所以原因是默认设置禁用了 HS2 交互式 HA 配置。 只需更改为 true 即可在 hive-site.xml 中解决此问题

    <property>
        <name>hive.server2.active.passive.ha.enable</name>
        <value>false</value> # change false to true
    </property>
    

    问题解决了!!!

    部分日志(与 Tez 相关):

    2018-11-16T18:45:14,835  INFO [main] server.HiveServer2: Web UI has started on port 10002
    
    2018-11-16T18:45:14,836  INFO [main] server.HiveServer2: HS2 interactive HA not enabled. Starting tez sessions..
    2018-11-16T18:45:14,836  INFO [main] server.HiveServer2: Starting/Reconnecting tez sessions..
    
    2018-11-16T18:45:14,836  INFO [main] server.HiveServer2: Initializing tez session pool manager
    2018-11-16T18:45:14,847  INFO [main] server.HiveServer2: Shutting down HiveServer2
    2018-11-16T18:45:14,847  INFO [main] service.AbstractService: Service:ThriftBinaryCLIService is stopped.
    2018-11-16T18:45:14,847  INFO [main] service.AbstractService: Service:OperationManager is stopped.
    2018-11-16T18:45:14,848  INFO [main] service.AbstractService: Service:SessionManager is stopped.
    2018-11-16T18:45:14,850  INFO [main] service.AbstractService: Service:CLIService is stopped.
    2018-11-16T18:45:14,850  INFO [main] service.AbstractService: Service:HiveServer2 is stopped.
    2018-11-16T18:45:14,847  INFO [main] thrift.ThriftCLIService: Thrift server has stopped
    2018-11-16T18:45:14,866  INFO [main] server.HiveServer2: Stopping/Disconnecting tez sessions.
    2018-11-16T18:45:14,866  INFO [main] server.HiveServer2: Stopped tez session pool manager.
    2018-11-16T18:45:14,869  WARN [main] server.HiveServer2: Error starting HiveServer2 on attempt 1, will retry in 60000ms
    java.lang.NoClassDefFoundError: org/apache/tez/dag/api/TezConfiguration
            at org.apache.hadoop.hive.ql.exec.tez.TezSessionPoolSession$AbstractTriggerValidator.startTriggerValidator(TezSessionPoolSession.java:74) ~[hive-exec-3.1.1.jar:3.1.1]
    

    【讨论】:

      【解决方案2】:

      我通过添加 hiveconf 来强制 hive 使用 mr 引擎而不是 tez 暂时解决了这个问题;

      像这样:

      hive -hiveconf hive.execution.engine=mr -e "my sql"

      但由于我想使用 tez,有人可以帮忙吗?

      【讨论】:

        【解决方案3】:

        对我来说,我必须将以下目录添加到类路径中。这是 mapr 特有的,但其他发行版会有类似的路径

        /opt/mapr/tez/tez-0.9/lib/*:/opt/mapr/tez/tez-0.9/*

        【讨论】:

          猜你喜欢
          • 2019-03-16
          • 2019-06-07
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-10-31
          • 1970-01-01
          相关资源
          最近更新 更多