我尝试连接到HiveServer2并从我的java应用程序运行查询。当我在本地服务器上运行时(Hive版本:2.1.1
)。它与以下依赖项完美配合:
compile('org.apache.hadoop:hadoop-core:1.2.1')
compile ('org.apache.hive:hive-jdbc:2.1.0'){
exclude group: 'org.eclipse.jetty.aggregate', module: '*'
exclude group: "org.slf4j", module: "slf4j-log4j12"
exclude group: "log4j", module: "log4j" }
compile ('org.apache.hadoop:hadoop-common:3.0.0'){
exclude group: "org.slf4j", module: "slf4j-log4j12"
exclude group: "log4j", module: "log4j"
}
但是当我在远程服务器上运行时(Hive版本:0.13.1-SNAPSHOT
)。它抛出了下面提到的错误。我知道,问题在于hive-jdbc,hadoop-core和hadoop-common版本。任何人都可以让我知道我需要为Hive 0.13.1-SNAPSHOT
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
答案 0 :(得分:0)
经过一些跟踪和错误后我修复了版本问题。问题是hive-jdbc:2.1.0与Hive 0.13.1-SNAPSHOT不向后兼容,我们需要使用hive-jdbc:0.13.1才能使它工作。下面的代码毫无疑问。
compile('org.apache.hadoop:hadoop-core:1.2.1')
compile ('org.apache.hive:hive-jdbc:0.13.1'){
exclude group: 'org.eclipse.jetty.aggregate', module: '*'
exclude group: "org.slf4j", module: "slf4j-log4j12"
exclude group: "log4j", module: "log4j" }
compile ('org.apache.hadoop:hadoop-common:3.0.0'){
exclude group: "org.slf4j", module: "slf4j-log4j12"
exclude group: "log4j", module: "log4j"
}