Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Get DATA from hive using apache nifi

Explorer

Hello guys hope u doing well

I'm trying to get data from Hive using apache nifi but I'm getting this error

10:49:06 CEST ERROR
SelectHiveQL[id=0ccbb0ab-fcf7-3037-e2c0-0ea5f7799f7c] Unable to execute HiveQL select query SELECT * FROM global_2g; due to org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Could not establish connection to jdbc:hive2://0.0.0.0:10000/tables;: Required field 'serverProtocolVersion' is unset! Struct:TOpenSessionResp(status:TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: taha is not allowed to impersonate anonymous:14:13, org.apache.hive.service.cli.session.SessionManager:createSession:SessionManager.java:434, org.apache.hive.service.cli.session.SessionManager:openSession:SessionManager.java:373, org.apache.hive.service.cli.CLIService:openSessionWithImpersonation:CLIService.java:195, org.apache.hive.service.cli.thrift.ThriftCLIService:getSessionHandle:ThriftCLIService.java:472, org.apache.hive.service.cli.thrift.ThriftCLIService:OpenSession:ThriftCLIService.java:322, org.apache.hive.service.rpc.thrift.TCLIService$Processor$OpenSession:getResult:TCLIService.java:1497, org.apache.hive.service.rpc.thrift.TCLIService$Processor$OpenSession:getResult:TCLIService.java:1482, org.apache.thrift.ProcessFunction:process:ProcessFunction.java:39, org.apache.thrift.TBaseProcessor:process:TBaseProcessor.java:39, org.apache.hive.service.auth.TSetIpAddressProcessor:process:TSetIpAddressProcessor.java:56, org.apache.thrift.server.TThreadPoolServer$WorkerProcess:run:TThreadPoolServer.java:286, java.util.concurrent.ThreadPoolExecutor:runWorker:ThreadPoolExecutor.java:1149, java.util.concurrent.ThreadPoolExecutor$Worker:run:ThreadPoolExecutor.java:624, java.lang.Thread:run:Thread.java:748, *java.lang.RuntimeException:java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: taha is not allowed to impersonate anonymous:22:8, org.apache.hive.service.cli.session.HiveSessionProxy:invoke:HiveSessionProxy.java:89, org.apache.hive.service.cli.session.HiveSessionProxy:access$000:HiveSessionProxy.java:36, org.apache.hive.service.cli.session.HiveSessionProxy$1:run:HiveSessionProxy.java:63, java.security.AccessController:doPrivileged:AccessController.java:-2, javax.security.auth.Subject:doAs:Subject.java:422, org.apache.hadoop.security.UserGroupInformation:doAs:UserGroupInformation.java:1762, org.apache.hive.service.cli.session.HiveSessionProxy:invoke:HiveSessionProxy.java:59, com.sun.proxy.$Proxy42:open::-1,

Here's some configurations that can help : 

er.PNG

er1.PNG

er2.PNG

I already added this to hive-site.xml : 

<property>
  <name>hive.server2.enable.doAs</name>
  <value>false</value> 
  </property>

If anyone can help thanks in advance  

4 REPLIES 4

Expert Contributor

Hello

 

Try to set the "Database User", e.g. hive

 

If you refer to the Hive2 JDBC documentation, the user ID is required

 

https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients#HiveServer2Clients-UsingJDBC

 

The default <port> is 10000. In non-secure configurations, specify a <user> for the query to run as. The <password> field value is ignored in non-secure mode.

Connection cnct = DriverManager.getConnection("jdbc:hive2://<host>:<port>", "<user>", "");

Explorer

thank you for the reply 

I'm not using any java code I'm just using apache nifi processor

Expert Contributor

Hello

 

On the NiFi Controller Service Details page, under tab properties, set the value for the "Database User"

Explorer

I already tried it 

11:35:11 CEST ERROR
SelectHiveQL[id=0ccbb0ab-fcf7-3037-e2c0-0ea5f7799f7c] Unable to execute HiveQL select query SELECT * FROM global_2g; due to org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Could not establish connection to jdbc:hive2://173.249.11.251:10000/tables;: Required field 'serverProtocolVersion' is unset! Struct:TOpenSessionResp(status:TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Failed to open new session: java.lang.RuntimeException:

er3.PNG

 

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.