如何在iReport中连接Hive?

发布于 2025-01-04 14:18:51 字数 1968 浏览 1 评论 0原文

我正在使用 Hadoop-0.20.0 和 Hive-0.8.0。现在我已将数据存入 Hive 表中,我想从中生成报告。为此,我使用iReport-4.5.0。为此,我还在 iReport 中下载了 HivePlugin-0.5.nbm

现在我要在iReport中连接Hive连接。

创建新数据源 -->新--> Hive 连接

Jdbc 驱动器org.apache.hadoop.hive.jdbc.HiveDriver

Jdbc URl< /strong>: jdbc:hive //localhost:10000/default

服务器地址: localhost

数据库默认

用户名root

< em>密码某个密码

然后单击“测试连接”按钮。

我收到这样的错误:

Exception

Message:
java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: java.lang.RuntimeException: Illegal Hadoop Version: Unknown (expected A.B.* format)

Level:

SEVERE

Stack Trace:

org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: 
java.lang.RuntimeException: Illegal Hadoop Version: Unknown (expected A.B.* format)
org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:226)
org.apache.hadoop.hive.jdbc.HiveConnection.<init>(HiveConnection.java:72)
org.apache.hadoop.hive.jdbc.HiveDriver.connect(HiveDriver.java:110)
com.jaspersoft.ireport.designer.connection.JDBCConnection.getConnection(JDBCConnection.java:140)
com.jaspersoft.ireport.hadoop.hive.connection.HiveConnection.getConnection(HiveConnection.java:48)
com.jaspersoft.ireport.designer.connection.JDBCConnection.test(JDBCConnection.java:447)
com.jaspersoft.ireport.designer.connection.gui.ConnectionDialog.jButtonTestActionPerformed(ConnectionDialog.java:335)
com.jaspersoft.ireport.designer.connection.gui.ConnectionDialog.access$300(ConnectionDialog.java:43)

任何人都可以帮助我吗?我哪里错了或者遗漏了什么?

I am using Hadoop-0.20.0 and Hive-0.8.0. Now i have data into Hive table and i want generate reports from that. For that I am using iReport-4.5.0. For that I also download HivePlugin-0.5.nbm in iReport.

Now I am going to connect Hive connection in iReport.

Create New Data source --> New --> Hive Connection

Jdbc Drive: org.apache.hadoop.hive.jdbc.HiveDriver

Jdbc URl: jdbc:hive//localhost:10000/default

Server Address: localhost

Database: default

user name: root

password: somepassword

Then click on Test connection button.

I am getting error like:

Exception

Message:
java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: java.lang.RuntimeException: Illegal Hadoop Version: Unknown (expected A.B.* format)

Level:

SEVERE

Stack Trace:

org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: 
java.lang.RuntimeException: Illegal Hadoop Version: Unknown (expected A.B.* format)
org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:226)
org.apache.hadoop.hive.jdbc.HiveConnection.<init>(HiveConnection.java:72)
org.apache.hadoop.hive.jdbc.HiveDriver.connect(HiveDriver.java:110)
com.jaspersoft.ireport.designer.connection.JDBCConnection.getConnection(JDBCConnection.java:140)
com.jaspersoft.ireport.hadoop.hive.connection.HiveConnection.getConnection(HiveConnection.java:48)
com.jaspersoft.ireport.designer.connection.JDBCConnection.test(JDBCConnection.java:447)
com.jaspersoft.ireport.designer.connection.gui.ConnectionDialog.jButtonTestActionPerformed(ConnectionDialog.java:335)
com.jaspersoft.ireport.designer.connection.gui.ConnectionDialog.access$300(ConnectionDialog.java:43)

Can any one help me in this? Where i am wrong or missing something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

那片花海 2025-01-11 14:18:51

“我还在 iReport 中下载了 HivePlugin-0.5.nbm。”
这还不清楚。 iReport 4.5 预装了 Hadoop Hive 连接器。为什么要单独下载连接器?你安装了这个插件吗?

创建新数据源 -->新--> Hive 连接
Jdbc驱动器:org.apache.hadoop.hive.jdbc.HiveDriver

...

当前的 Hadoop Hive 连接器无法实现这一点。当您创建新的“Hadoop Hive 连接”时,您只需要填写一个参数:url。
在此处输入图像描述

我猜测您在打算创建 Hadoop Hive 连接时创建了 JDBC 连接。这是合乎逻辑的事情。 Hive 通过 JDBC 访问。但 Hive JDBC 驱动程序仍然很新。它有许多缺点。这就是 Hive 连接器被添加到 iReport 的原因。它基于 Hive JDBC 驱动程序,但它包含一个包装器以避免一些问题。

或者,您可能在 iReport 4.5 中已包含的连接器之上安装了旧的 Hive 连接器。在过去的某个时刻,Hive 连接器允许您填写额外的信息,例如 JDBC 驱动程序。

从全新的 iReport 安装开始,并确保使用 Hadoop Hive 连接。这样应该就可以清楚了。

"I also download HivePlugin-0.5.nbm in iReport."
This isn't clear. iReport 4.5 has the Hadoop Hive connector pre-installed. Why did you download the connector separately? Did you install this plugin?

Create New Data source --> New --> Hive Connection
Jdbc Drive: org.apache.hadoop.hive.jdbc.HiveDriver

...

This isn't possible with the current Hadoop Hive connector. When you create a new "Hadoop Hive Connection" you are given only one parameter to fill out: the url.
enter image description here

I'm guessing that you created a JDBC connection when you meant to create a Hadoop Hive connection. This is a logical thing to do. Hive is accessed via JDBC. But the Hive JDBC driver is still pretty new. It has a number of shortcomings. That's why the Hive connector was added to iReport. It is based on the Hive JDBC driver, but it includes a wrapper around it to avoid some problems.

Or maybe you installed an old Hive connector over the top of the one that's already included with iReport 4.5. At some point in the past the Hive connector let you fill in extra information like the JDBC Driver.

Start with a fresh iReport installation, and make sure you use the Hadoop Hive Connection. That should clear it up.

零度℉ 2025-01-11 14:18:51

出现错误“java.lang.RuntimeException: Illegal Hadoop Version: Unknown (expected AB* format)”是因为 hadoop-common.jar 中的 VersionInfo 类尝试使用当前线程的类加载器查找版本信息。

https://github.com/apache/hadoop/blob/release-2.6.0/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ VersionInfo.java#L41-L58

有问题的代码如下所示...

package org.apache.hadoop.util;
...
public class VersionInfo {
...
  protected VersionInfo(String component) {
    info = new Properties();
    String versionInfoFile = component + "-version-info.properties";
    InputStream is = null;
    try {
      is = Thread.currentThread().getContextClassLoader()
        .getResourceAsStream(versionInfoFile);
      if (is == null) {
        throw new IOException("Resource not found");
      }
      info.load(is);
    } catch (IOException ex) {
      LogFactory.getLog(getClass()).warn("Could not read '" +
          versionInfoFile + "', " + ex.toString(), ex);
    } finally {
      IOUtils.closeStream(is);
    }
  }

如果您的工具尝试在单独的线程中连接到数据源,它将生成此错误。

解决此问题的最简单方法是将 hadoop-common.jar 库放在 $JAVA_HOME/lib/ext 中,或使用命令行设置 -Djava.endorsed.dirs 指向 hadoop-common.jar 库。那么线程的类加载器就总能找到这个信息。

The error "java.lang.RuntimeException: Illegal Hadoop Version: Unknown (expected A.B.* format)" happens because the VersionInfo class in hadoop-common.jar attempts to locate the version info using the current thread's class loader.

https://github.com/apache/hadoop/blob/release-2.6.0/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/VersionInfo.java#L41-L58

The code in question looks like this...

package org.apache.hadoop.util;
...
public class VersionInfo {
...
  protected VersionInfo(String component) {
    info = new Properties();
    String versionInfoFile = component + "-version-info.properties";
    InputStream is = null;
    try {
      is = Thread.currentThread().getContextClassLoader()
        .getResourceAsStream(versionInfoFile);
      if (is == null) {
        throw new IOException("Resource not found");
      }
      info.load(is);
    } catch (IOException ex) {
      LogFactory.getLog(getClass()).warn("Could not read '" +
          versionInfoFile + "', " + ex.toString(), ex);
    } finally {
      IOUtils.closeStream(is);
    }
  }

If your tool attempts to connect to the datasource in a separate thread, it will generate this error.

The easiest way to work around the issue is to put the hadoop-common.jar library in $JAVA_HOME/lib/ext or use the command line setting -Djava.endorsed.dirs to point to the hadoop-common.jar library. Then the thread's class loader will always be able to find this information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文