2016-05-07 6 views
0
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; 
}} 

をorg.apacheはできません。 WEB/INFでlibsを追加しようとしました。コモンズコーデック1.10、commons fileupload 1.3.1、commons io 2.5、その他のすべてのライブラリを追加しました。は、Javaの(豚UDF)がライブラリを追加し、これらのエラーを解決するため、私がやっているプロジェクトは、Hadoopの(豚、ハイブ、すくう、oozie)</p> <p>を使用して、Webログ解析(攻撃検出)である

私は前にこれらのエラーが発生していませんでした。

私は初心者です。助けを借りれば大変感謝します。

答えて

0

クラスパスにcommons-logging jarを追加してください。エラーを修正するはずです。

関連する問題