hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Dere <jd...@hortonworks.com>
Subject Re: Error in running udf that interacts with hive jdbc client
Date Thu, 02 Oct 2014 19:46:30 GMT

It looks like the issue is here at the bottom of the list of stack traces, where it can't
resolve the HiveDriver class. I think only hive-exec.jar is shipped as part of a map/reduce
job, you would have to make sure hive-jdbc is in the class path during the map/reduce jobs.
Are you sure your UDF is actually able to run the query, since this error seems to be occurring
during your UDF initialization? Not sure if running a separate query within a UDF is something
that would be recommended, though maybe others can speak on that.

> Caused by: java.lang.ClassNotFoundException: org.apache.hive.jdbc.HiveDriver
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:186)
> 	at com.impetus.ilabs.etloffload.common.utils.HiveJDBCConnectionFactory.<init>(HiveJDBCConnectionFactory.java:23)
> 	... 44 more



On Oct 1, 2014, at 8:09 AM, reena upadhyay <reena2485@gmail.com> wrote:

> Hi,
> 
> 
> I have a single argument udf that takes the sql string as a argument. Inside the udf,
I have used hive jdbc client to execute the query. My query execution part inside udf is working
fine and also I am able to get the desired result from the query. My udf is returning a String.
 I am getting error in returning the result from the evaluate method of a udf.
> 
> Stack trace:
> java.lang.RuntimeException: Error in configuring object
> 	at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:93)
> 	at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:64)
> 	at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
> 	at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:432)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:372)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:415)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1136)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:249)
> Caused by: java.lang.reflect.InvocationTargetException
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:601)
> 	at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
> 	... 9 more
> Caused by: java.lang.RuntimeException: Error in configuring object
> 	at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:93)
> 	at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:64)
> 	at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
> 	at org.apache.hadoop.mapred.MapRunner.configure(MapRunner.java:34)
> 	... 14 more
> Caused by: java.lang.reflect.InvocationTargetException
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:601)
> 	at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
> 	... 17 more
> Caused by: java.lang.RuntimeException: Map operator initialization failed
> 	at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:154)
> 	... 22 more
> Caused by: org.apache.hadoop.hive.ql.exec.UDFArgumentException: org.apache.hadoop.hive.ql.metadata.HiveException:
Unable to execute method public java.lang.String com.impetus.ilabs.etloffload.udf.UDFType.evaluate(org.apache.hadoop.io.Text)
 on object com.impetus.ilabs.etloffload.udf.UDFType@3ff839e8 of class com.impetus.ilabs.etloffload.udf.UDFType
with arguments {employeeudf.age:org.apache.hadoop.io.Text} of size 1
> 	at org.apache.hadoop.hive.ql.udf.generic.GenericUDF.initializeAndFoldConstants(GenericUDF.java:148)
> 	at org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator.initialize(ExprNodeGenericFuncEvaluator.java:127)
> 	at org.apache.hadoop.hive.ql.exec.Operator.initEvaluators(Operator.java:931)
> 	at org.apache.hadoop.hive.ql.exec.Operator.initEvaluatorsAndReturnStruct(Operator.java:957)
> 	at org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
> 	at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:376)
> 	at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:460)
> 	at org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:416)
> 	at org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:189)
> 	at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:376)
> 	at org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:425)
> 	at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:376)
> 	at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
> 	... 22 more
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Unable to execute method
public java.lang.String com.impetus.ilabs.etloffload.udf.UDFType.evaluate(org.apache.hadoop.io.Text)
 on object com.impetus.ilabs.etloffload.udf.UDFType@3ff839e8 of class com.impetus.ilabs.etloffload.udf.UDFType
with arguments {employeeudf.age:org.apache.hadoop.io.Text} of size 1
> 	at org.apache.hadoop.hive.ql.exec.FunctionRegistry.invoke(FunctionRegistry.java:1243)
> 	at org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge.evaluate(GenericUDFBridge.java:182)
> 	at org.apache.hadoop.hive.ql.udf.generic.GenericUDF.initializeAndFoldConstants(GenericUDF.java:145)
> 	... 34 more
> Caused by: java.lang.reflect.InvocationTargetException
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:601)
> 	at org.apache.hadoop.hive.ql.exec.FunctionRegistry.invoke(FunctionRegistry.java:1219)
> 	... 36 more
> Caused by: java.lang.ExceptionInInitializerError
> 	at com.impetus.ilabs.etloffload.udf.UDFType.getColType(UDFType.java:82)
> 	at com.impetus.ilabs.etloffload.udf.UDFType.evaluate(UDFType.java:76)
> 	... 41 more
> Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.hive.jdbc.HiveDriver
> 	at com.impetus.ilabs.etloffload.common.utils.HiveJDBCConnectionFactory.<init>(HiveJDBCConnectionFactory.java:27)
> 	at com.impetus.ilabs.etloffload.common.utils.HiveJDBCConnectionFactory.<clinit>(HiveJDBCConnectionFactory.java:15)
> 	... 43 more
> Caused by: java.lang.ClassNotFoundException: org.apache.hive.jdbc.HiveDriver
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:186)
> 	at com.impetus.ilabs.etloffload.common.utils.HiveJDBCConnectionFactory.<init>(HiveJDBCConnectionFactory.java:23)
> 	... 44 more
> 
> 
> Any help would be highle appreciated. 


-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.

Mime
View raw message