For connecting hive through spring application i have added below dependency in pom.xml.
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libfb303</artifactId>
<version>0.9.3</version>
<exclusions>
<exclusion>
<groupId>org.apache.hive</groupId>
<artifactId>hive-common</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-service-rpc</artifactId>
<version>2.1.1</version>
</dependency>
But still i am facing the below exception :: Caused by: java.lang.NoClassDefFoundError: org/apache/hive/service/cli/HiveSQLException at org.apache.hive.jdbc.HiveConnection.(HiveConnection.java:132) at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:107) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:208) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:164) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119) at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:71) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:113) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2836) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2832) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:268) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) ... 97 more Caused by: java.lang.ClassNotFoundException: org.apache.hive.service.cli.HiveSQLException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558) ... 116 more
Any one please tell me if any jars i am missing or what is the issue.Using the same url i am able to connect through beeline
$HIVE_HOME/bin/beeline -u jdbc:hive2://localhost:10000/TEST_DB
I have refer below url but it contains no answer
finally able to connect hive through spring application.This type of exception which i have asked we got due to compatibility issue with jars i.e some version are not compatible to used with spring.Below i am attaching my pom.xml for more clarification.
After that you may encounter with authentication issue while running the appliation.Please run below command for that.
If their is no folder structure then it will create and give the read,write permission to that.
I think you need hive-service.jar. Add this and verify if it works.