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中添加libs,添加了commons codec 1.10,commons fileupload 1.3.1,commons io 2.5以及我能找到的所有其他库。
我之前没有收到这些错误。
我是初学者,非常感谢帮助/修复。
答案 0 :(得分:1)
在类路径中添加commons-logging jar
。它应该修复错误。