Skip to main content
ThomasCloudeara
Silver ⭐️⭐️
March 20, 2023
Question

Not able to connect ImpalaDB from Springboot application

I am trying to connect remote ImpalaDB in my springboot application.

 

In pom.xml I am having following dependency for impalaDB:

<dependency>
<groupId>com.cloudera</groupId>
<artifactId>ImpalaJDBC41</artifactId>
<version>2.6.4.1005</version>
</dependency>

  and in application.properties:

 

server.port=9090
spring.application.name=ImpalaConnect
spring.cloud.config.enabled=false
spring.datasource.driver-class-name=com.cloudera.impala.jdbc41.Driver
spring.datasource.url=jdbc:impala://remote-impala-address:21050;AuthMech=3;UID=user_id;PWD=@PassWord;SSL=1;AllowSelfSignedCerts=1;

 when I run the application , its giving me following error:

 

java.sql.SQLException: [Cloudera][ImpalaJDBCDriver](500164) Error initialized or created transport for authentication: [Cloudera][ImpalaJDBCDriver](500592) Authentication failed..
at com.cloudera.impala.hivecommon.api.HiveServer2ClientFactory.createTransport(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.hivecommon.api.HiveServer2ClientFactory.createClient(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.hivecommon.core.HiveJDBCCommonConnection.establishConnection(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.impala.core.ImpalaJDBCConnection.establishConnection(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.jdbc.core.LoginTimeoutConnection$1.call(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.jdbc.core.LoginTimeoutConnection$1.call(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
Caused by: com.cloudera.impala.support.exceptions.GeneralException: [Cloudera][ImpalaJDBCDriver](500164) Error initialized or created transport for authentication: [Cloudera][ImpalaJDBCDriver](500592) Authentication failed..
... 9 common frames omitted
Caused by: com.cloudera.impala.jdbc41.internal.apache.thrift.transport.TTransportException: null
at com.cloudera.impala.jdbc41.internal.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.jdbc41.internal.apache.thrift.transport.TTransport.readAll(TTransport.java:84) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.jdbc41.internal.apache.thrift.transport.TSaslTransport.receiveSaslMessage(TSaslTransport.java:178) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.jdbc41.internal.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:288) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.jdbc41.internal.apache.thrift.transport.TSaslClientTransport.open(TSaslClientTransport.java:37) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.hivecommon.api.HiveServer2ClientFactory.createTransport(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.hivecommon.api.HiveServer2ClientFactory.createClient(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.hivecommon.core.HiveJDBCCommonConnection.establishConnection(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.impala.core.ImpalaJDBCConnection.establishConnection(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.jdbc.core.LoginTimeoutConnection$1.call(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at com.cloudera.impala.jdbc.core.LoginTimeoutConnection$1.call(Unknown Source) ~[ImpalaJDBC41-2.6.4.1005.jar:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]

2023-03-20 13:24:57.541 WARN 6604 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchDataSourceInitializer' defined in class path resource [org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration$DataSourceInitializerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.batch.BatchDataSourceScriptDatabaseInitializer]: Factory method 'batchDataSourceInitializer' threw exception; nested exception is java.lang.IllegalStateException: Unable to detect database type
2023-03-20 13:24:57.543 INFO 6604 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2023-03-20 13:24:57.551 INFO 6604 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-03-20 13:24:57.566 ERROR 6604 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchDataSourceInitializer' defined in class path resource [org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration$DataSourceInitializerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.batch.BatchDataSourceScriptDatabaseInitializer]: Factory method 'batchDataSourceInitializer' threw exception; nested exception is java.lang.IllegalStateException: Unable to detect database type
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.22.jar:5.3.22]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.22.jar:5.3.22]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.22.jar:5.3.22]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.2.jar:2.7.2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.2.jar:2.7.2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.2.jar:2.7.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.2.jar:2.7.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.2.jar:2.7.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.2.jar:2.7.2]
at ALM.ImpalaConnect.ImpalaConnectApplication.main(ImpalaConnectApplication.java:10) ~[classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.batch.BatchDataSourceScriptDatabaseInitializer]: Factory method 'batchDataSourceInitializer' threw exception; nested exception is java.lang.IllegalStateException: Unable to detect database type
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.22.jar:5.3.22]
... 21 common frames omitted
Caused by: java.lang.IllegalStateException: Unable to detect database type
at org.springframework.util.Assert.state(Assert.java:76) ~[spring-core-5.3.22.jar:5.3.22]
at org.springframework.boot.jdbc.init.PlatformPlaceholderDatabaseDriverResolver.determinePlatform(PlatformPlaceholderDatabaseDriverResolver.java:132) ~[spring-boot-2.7.2.jar:2.7.2]
at org.springframework.boot.jdbc.init.PlatformPlaceholderDatabaseDriverResolver.lambda$resolveAll$0(PlatformPlaceholderDatabaseDriverResolver.java:96) ~[spring-boot-2.7.2.jar:2.7.2]
at org.springframework.boot.jdbc.init.PlatformPlaceholderDatabaseDriverResolver.resolveAll(PlatformPlaceholderDatabaseDriverResolver.java:121) ~[spring-boot-2.7.2.jar:2.7.2]
at org.springframework.boot.jdbc.init.PlatformPlaceholderDatabaseDriverResolver.resolveAll(PlatformPlaceholderDatabaseDriverResolver.java:96) ~[spring-boot-2.7.2.jar:2.7.2]
at org.springframework.boot.autoconfigure.batch.BatchDataSourceScriptDatabaseInitializer.resolveSchemaLocations(BatchDataSourceScriptDatabaseInitializer.java:86) ~[spring-boot-autoconfigure-2.7.2.jar:2.7.2]
at org.springframework.boot.autoconfigure.batch.BatchDataSourceScriptDatabaseInitializer.getSettings(BatchDataSourceScriptDatabaseInitializer.java:73) ~[spring-boot-autoconfigure-2.7.2.jar:2.7.2]
at org.springframework.boot.autoconfigure.batch.BatchDataSourceScriptDatabaseInitializer.<init>(BatchDataSourceScriptDatabaseInitializer.java:48) ~[spring-boot-autoconfigure-2.7.2.jar:2.7.2]
at org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration$DataSourceInitializerConfiguration.batchDataSourceInitializer(BatchAutoConfiguration.java:116) ~[spring-boot-autoconfigure-2.7.2.jar:2.7.2]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.22.jar:5.3.22]
... 22 common frames omitted


Process finished with exit code 1

 

Any suggestion?

6 replies

DianaTorres
Community Manager
Community Manager
March 20, 2023

@ThomasCloudeara Welcome to the Cloudera Community!

To help you get the best possible solution, I have tagged our Impala  experts @mszurap  and @bbreak  who may be able to assist you further.

Please keep us updated on your post, and we hope you find a satisfactory solution to your query.

Translate
Regards, Diana Torres, Senior Community Moderator
mszurap
Platinum ⭐️
Platinum ⭐️
March 21, 2023

Hi @ThomasCloudeara , 

First, the JDBC driver v2.6.4 is very old. Kindly use the latest one, download it from our website:

https://www.cloudera.com/downloads/connectors/impala/jdbc/

Preferably use the "JDBC4.2" specification driver, with that use

"com.cloudera.impala.jdbc.Driver" instead.

Second, please follow the guide

https://docs.cloudera.com/documentation/other/connectors/impala-jdbc/2-6-30/Cloudera-JDBC-Connector-for-Apache-Impala-Install-Guide.pdf

and verify the JDBC connection string:
- if the LDAP authentication is really enabled (AuthMech=3 tells that) or if you have Kerberos authentication only in your cluster (which needs AuthMech=1)
- if LDAP auth is really enabled, can you connect to Impala with impala-shell with the same username/password pair? 

 

Thanks

 Miklos

Translate
ThomasCloudeara
Silver ⭐️⭐️
March 23, 2023

Thanks for you reply @mszurap .

Would you specify me the maven dependency for ImpalaDB that I need to use?

 

Currently I am trying with 

<dependency>
<groupId>com.cloudera</groupId>
<artifactId>ImpalaJDBC41</artifactId>
<version>2.6.4.1005</version>
</dependency>

 which creates an external springboot library com.cloudera.ImpalaJDBC41:2.6.4.jar. When tried the dependency 4.2 , it could not download the jar.

Translate
mszurap
Platinum ⭐️
Platinum ⭐️
March 23, 2023

Hi  @ThomasCloudeara ,

The ImpalaJDBC library/dependency is not published into any public maven repository due to licensing questions. After accepting the license terms you need to download the .zip from our download site, extract it, and "install" the ImpalaJDBC42.jar into one of your company wide or to your machine local maven repository. 
Follow the Maven guide:

https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

Translate