Не удается устранить эти ошибки Java (Pig UDF) при добавлении библиотек, org.apache
package com.mirox.weblog; //error here -The type org.apache.commons.logging.Log cannot be resolved. It is indirectly referenced from required .class files
import java.io.IOException;
import java.text.SimpleDateFormat;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
/* To convert date to hive usable format
*/
public class Date_udf extends EvalFunc{
public String exec(Tuple input)
{
if(input == null || input.size() == 0)
return null;
String s = "";
String p = "";
try
{
if(input.get(0) != null) //error here in input.get(0) -The type org.apache.hadoop.io.WritableComparable cannot be resolved. It is indirectly referenced from required .class files
{
s = input.get(0).toString();
SimpleDateFormat fromFormat = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss");//input date format
SimpleDateFormat toFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//output date +format
p = toFormat.format(fromFormat.parse(s));// converting date format
}
}
catch(Exception e)
{
e.printStackTrace();
}
return p;
}}
Проект, который я делаю, - анализ веб-журнала (обнаружение атаки) с использованием Hadoop (pig, hive, scoop, oozie)
Попытался добавить библиотеки в WEB/INF, добавил кодек 1.10 для общего ресурса, файл загрузки 1.3.1 для общего ресурса, io 2.5 и все остальные библиотеки, которые я смог найти.
Я не получал эти ошибки раньше.
Я новичок, помощь / починка была бы очень признательна.
1 ответ
Добавлять commons-logging jar
в вашем классе Это должно исправить ошибку.