Hive connection attempt throws java.lang.LinkageError when using Hive 1.2 standalone.jar

Hive connection attempt throws java.lang.LinkageError when using Hive 1.2 standalone.jar

book

Article ID: KB0078692

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization v7.0.x, 8.0

Description

A TDV connection attempt using Hive jdbc version 1.2 to connect to a Hive datasource that may return this error:


Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of com/compositesw/common/ReverseDelegateClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of java/net/URLClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:299)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
        at org.apache.hive.service.auth.HiveAuthFactory.<clinit>(HiveAuthFactory.java:68)
        at org.apache.hive.jdbc.HiveConnection.createBinaryTransport(HiveConnection.java:447)
        at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:191)
        at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:155)
        at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
        at com.compositesw.cdms.ds.hive2.Hive2JdbcConnectionInitiator.createConnection(Hive2JdbcConnectionInitiator.java:47)
        at com.compositesw.cdms.ds.hive2.Hive2JdbcConnectionInitiator.initiateConnection(Hive2JdbcConnectionInitiator.java:32)
        at com.compositesw.cdms.ds.hive2.Hive2DataSource$1.initiateConnection(Hive2DataSource.java:137)
        at com.compositesw.common.pool.jdbc.JdbcConnectionFactory.create(JdbcConnectionFactory.java:100)
        at com.compositesw.cdms.ds.jdbc.JdbcDataSource.getPoolFactoryWithValidation(JdbcDataSource.java:213)
        at com.compositesw.cdms.ds.jdbc.JdbcDataSource.getPoolFactoryWithValidation(JdbcDataSource.java:54)
        at com.compositesw.cdms.datasource.PhysicalConnectionPoolManager.createPool(PhysicalConnectionPoolManager.java:95)
        ... 43 more


 

Issue/Introduction

This concerns datasource connectivity from TDV to Hive.

Resolution

If you encounter this error while using Hive's "standalone" jar file to support our Hive adapter, you will need to modify this jar file (ie; hive-jdbc-1.2.2-standalone.jar).
Open the jar file (using winzip will suffice) and remove the org\slf4j directory from the jar file's contents.
Save the resulting jar file and place that back into your TDV server's \conf\adapters\system\<your Hive adapter version>

Restart the server to reload the jar file.  The connection is now expected to succeed.