Zdenek Ott created HIVE-4778:
--------------------------------

             Summary: hive.server2.authentication CUSTOM not working
                 Key: HIVE-4778
                 URL: https://issues.apache.org/jira/browse/HIVE-4778
             Project: Hive
          Issue Type: Bug
          Components: Authentication
    Affects Versions: 0.11.0
         Environment: CentOS release 6.2 x86_64
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
            Reporter: Zdenek Ott


I have created my own class PamAuthenticationProvider that implements 
PasswdAuthenticationProvider interface. I have puted jar into hive lib 
directory and have configured hive-site.xml in following way:

<property>
  <name>hive.server2.authentication</name>
  <value>CUSTOM</value>
</property>

<property>
  <name>hive.server2.custom.authentication.class</name>
  <value>com.avast.ff.hive.PamAuthenticationProvider</value>
</property>


I use SQuireL and jdbc drivers to connect to hive. During authentication Hive 
throws following exception:

java.lang.RuntimeException: java.lang.NoSuchMethodException: 
org.apache.hive.service.auth.PasswdAuthenticationProvider.<init>()
        at 
org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:128)
        at 
org.apache.hive.service.auth.CustomAuthenticationProviderImpl.<init>(CustomAuthenticationProviderImpl.java:20)
        at 
org.apache.hive.service.auth.AuthenticationProviderFactory.getAuthenticationProvider(AuthenticationProviderFactory.java:57)
        at 
org.apache.hive.service.auth.PlainSaslHelper$PlainServerCallbackHandler.handle(PlainSaslHelper.java:61)
        at 
org.apache.hive.service.auth.PlainSaslServer.evaluateResponse(PlainSaslServer.java:127)
        at 
org.apache.thrift.transport.TSaslTransport$SaslParticipant.evaluateChallengeOrResponse(TSaslTransport.java:509)
        at 
org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:264)
        at 
org.apache.thrift.transport.TSaslServerTransport.open(TSaslServerTransport.java:41)
        at 
org.apache.thrift.transport.TSaslServerTransport$Factory.getTransport(TSaslServerTransport.java:216)
        at 
org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:189)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoSuchMethodException: 
org.apache.hive.service.auth.PasswdAuthenticationProvider.<init>()
        at java.lang.Class.getConstructor0(Class.java:2706)
        at java.lang.Class.getDeclaredConstructor(Class.java:1985)
        at 
org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:122)
        ... 12 more



I have done small patch for 
org.apache.hive.service.auth.CustomAuthenticationProviderImpl , that have 
solved my problem, but I'm not sure if it's the best solution. Here is the 
patch:

--- CustomAuthenticationProviderImpl.java       2013-06-20 14:55:22.473995184 
+0200
+++ CustomAuthenticationProviderImpl.java.new   2013-06-20 14:57:36.549012966 
+0200
@@ -33,7 +33,7 @@
     HiveConf conf = new HiveConf();
     this.customHandlerClass = (Class<? extends PasswdAuthenticationProvider>)
         conf.getClass(
-            HiveConf.ConfVars.HIVE_SERVER2_CUSTOM_AUTHENTICATION_CLASS.name(),
+            HiveConf.ConfVars.HIVE_SERVER2_CUSTOM_AUTHENTICATION_CLASS.varname,
             PasswdAuthenticationProvider.class);
     this.customProvider =
         ReflectionUtils.newInstance(this.customHandlerClass, conf);


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to