Reply
Highlighted
Explorer
Posts: 30
Registered: ‎05-18-2017
Accepted Solution

Unable to create UDF in cloudera quickstart VM

I would like to create UDF on Cloudera VM, when i try to create a temporary function i am getting following Error.

FAILED: Execution Error, return code -101 from org.apache.hadoop.hive.ql.exec.FunctionTask.
com/udf/StringSplitter : Unsupported major.minor version 52.0

Below i am attaching my sample Java Class 

package com.udf;

import org.apache.hadoop.hive.ql.exec.UDF;

public class StringSplitter extends UDF {
	
	public String[] evaluate(String name) {
		
		String[] result = name.split("[\\''/*]");
 		return result;
	}

}

i have created an executable jar and added on Cloudera. But i am unable to create Temporary Function.

hive> add jar Desktop/StringSplitter.jar;
Added [Desktop/StringSplitter.jar] to class path
Added resources: [Desktop/StringSplitter.jar]

hive> create temporary function strsplit as 'com.udf.StringSplitter'; FAILED: Execution Error, return code -101 from org.apache.hadoop.hive.ql.exec.FunctionTask. com/udf/StringSplitter : Unsupported major.minor version 52.0
Cloudera Employee
Posts: 430
Registered: ‎03-23-2015

Re: Unable to create UDF in cloudera quickstart VM

Hi,

The error message "Unsupported major.minor version 52.0" means the UDF jar file was compile on a version of Java that is different to the one used for HS2.

If you run below command:

javap -verbose com/udf/StringSplitter.class | grep "major"

What is the number returned?

Below are the major version number for different version of Java:

Java 5 uses major version 49
Java 6 uses major version 50
Java 7 uses major version 51
Java 8 uses major version 52
Java 9 uses major version 53

So you need to compile using the Java that has the same version that HS2 runs under.

Hope above helps.
Announcements