You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Ruslan Peshchuk (JIRA)" <ji...@apache.org> on 2012/07/13 10:16:34 UTC

[jira] [Commented] (HIVE-3007) Following error occured when establishing the sample HIVE JDBC connection

    [ https://issues.apache.org/jira/browse/HIVE-3007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13413575#comment-13413575 ] 

Ruslan Peshchuk commented on HIVE-3007:
---------------------------------------

I've got the same bug trying to use Hive JDBC driver in embedded mode in Jboss.

Steps to reproduce:
1) Create folders structure under the Jboss folder: jboss/modules/org/apache/hive/jdbc/main

2) Create symlinks:
ln -s hive/conf jboss/modules/org/apache/hive/jdbc/main/conf
ln -s hive/lib jboss/modules/org/apache/hive/jdbc/main/hive_lib
ln -s hadoop jboss/modules/org/apache/hive/jdbc/main/hadoop

3) Put module.xml (attached to the ticket) referencing Hadoop and Hive libraries in jboss/modules/org/apache/hive/jdbc/main

4) Correct your configuration file jboss/standalone/configuration/standalone.xml:
...
<subsystem xmlns="urn:jboss:domain:ee:1.0">
  <global-modules>
    <module name="org.apache.hive.jdbc" slot="main" />
  </global-modules>
</subsystem>
...
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
  <datasources>
    <datasource jndi-name="java:/jdbc/HiveDS" pool-name="HiveDS" enabled="true" use-java-context="true">
      <connection-url>jdbc:hive://</connection-url>
      <driver>hive</driver>
      <pool>
        <min-pool-size>2</min-pool-size>
        <max-pool-size>2</max-pool-size>
        <prefill>false</prefill>
      </pool>
      <security>
        <user-name></user-name>
        <password></password>
      </security>
    </datasource>
    <drivers>
      <driver name="hive" module="org.apache.hive.jdbc">
        <driver-class>org.apache.hadoop.hive.jdbc.HiveDriver</driver-class>
        <datasource-class>org.apache.hadoop.hive.jdbc.HiveDataSource</datasource-class>
      </driver>
    </drivers>
  </datasources>
</subsystem>
...

5) Inject the Hive datasource in any bean:
@Resource(name = "java:/jdbc/HiveDS")
private DataSource dataSource;

6) Try to execute query "show tables" on this datasource.

7) You'll see the next stacktrace in the log file:
...
Caused by: java.lang.RuntimeException: Failed to load Hive builtin functions
        at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:205) [hive-exec-0.9.0.jar:0.9.0]
        at org.apache.hadoop.hive.service.HiveServer$HiveServerHandler.<init>(HiveServer.java:135) [hive-service-0.9.0.jar:0.9.0]
        at org.apache.hadoop.hive.service.HiveServer$HiveServerHandler.<init>(HiveServer.java:121) [hive-service-0.9.0.jar:0.9.0]
        at org.apache.hadoop.hive.jdbc.HiveConnection.<init>(HiveConnection.java:94) [hive-jdbc-0.9.0.jar:0.9.0]
        at org.apache.hadoop.hive.jdbc.HiveDriver.connect(HiveDriver.java:104) [hive-jdbc-0.9.0.jar:0.9.0]
        at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)
        ... 145 more
Caused by: java.net.MalformedURLException: no !/ in spec
        at java.net.URL.<init>(URL.java:617) [rt.jar:1.7.0_04]
        at java.net.URL.<init>(URL.java:480) [rt.jar:1.7.0_04]
        at java.net.URL.<init>(URL.java:429) [rt.jar:1.7.0_04]
        at java.net.JarURLConnection.parseSpecs(JarURLConnection.java:179) [rt.jar:1.7.0_04]
        at java.net.JarURLConnection.<init>(JarURLConnection.java:162) [rt.jar:1.7.0_04]
        at sun.net.www.protocol.jar.JarURLConnection.<init>(JarURLConnection.java:81) [rt.jar:1.7.0_04]
        at sun.net.www.protocol.jar.Handler.openConnection(Handler.java:41) [rt.jar:1.7.0_04]
        at java.net.URL.openConnection(URL.java:969) [rt.jar:1.7.0_04]
        at java.net.URL.openStream(URL.java:1035) [rt.jar:1.7.0_04]
        at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerFunctionsFromPluginJar(FunctionRegistry.java:1226) [hive-exec-0.9.0.jar:0.9.0]
        at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:202) [hive-exec-0.9.0.jar:0.9.0]
        ... 150 more
Caused by: java.lang.NullPointerException: no !/ in spec
        at sun.net.www.protocol.jar.Handler.parseAbsoluteSpec(Handler.java:170) [rt.jar:1.7.0_04]
        at sun.net.www.protocol.jar.Handler.parseURL(Handler.java:150) [rt.jar:1.7.0_04]
        at java.net.URL.<init>(URL.java:612) [rt.jar:1.7.0_04]
        ... 160 more

I've fixed this bug. The patch is in the attachment.
                
> Following error occured when establishing the sample HIVE JDBC connection
> -------------------------------------------------------------------------
>
>                 Key: HIVE-3007
>                 URL: https://issues.apache.org/jira/browse/HIVE-3007
>             Project: Hive
>          Issue Type: Bug
>         Environment: Linux 
>            Reporter: victorWang
>         Attachments: [HIVE-3007].patch, module.xml
>
>
> Exception in thread "main" java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>         at java.lang.reflect.Method.invoke(Method.java:611)
>         at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
> Caused by: java.lang.RuntimeException: Failed to load Hive builtin functions
>         at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:190)
>         at org.apache.hadoop.hive.jdbc.JdbcSessionState.<init>(JdbcSessionState.java:31)
>         at org.apache.hadoop.hive.jdbc.HiveConnection.<init>(HiveConnection.java:62)
>         at org.apache.hadoop.hive.jdbc.HiveDriver.connect(HiveDriver.java:108)
>         at java.sql.DriverManager.getConnection(DriverManager.java:322)
>         at java.sql.DriverManager.getConnection(DriverManager.java:358)
>         at HiveJdbcClient.main(HiveJdbcClient.java:24)
>         ... 5 more
> Caused by: java.net.MalformedURLException: no !/ in spec
>         at java.net.URL.<init>(URL.java:613)
>         at java.net.URL.<init>(URL.java:476)
>         at java.net.URL.<init>(URL.java:425)
>         at java.net.JarURLConnection.parseSpecs(JarURLConnection.java:162)
>         at java.net.JarURLConnection.<init>(JarURLConnection.java:155)
>         at sun.net.www.protocol.jar.JarURLConnection.<init>(JarURLConnection.java:78)
>         at sun.net.www.protocol.jar.Handler.openConnection(Handler.java:36)
>         at java.net.URL.openConnection(URL.java:957)
>         at java.net.URL.openStream(URL.java:1022)
>         at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerFunctionsFromPluginJar(FunctionRegistry.java:1194)
>         at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:187)
>         ... 11 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira