【问题标题】:Cannot solve these errors Java (Pig UDF) adding libraries, org.apache无法解决这些错误 Java (Pig UDF) 添加库、org.apache
【发布时间】:2016-05-07 04:42:07
【问题描述】:
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 日志分析(攻击检测)

尝试在 WEB/INF 中添加库,添加了 commons 编解码器 1.10、commons fileupload 1.3.1、commons io 2.5 以及我能找到的所有其他库。

我以前没有遇到这些错误。

我是初学者,非常感谢您提供帮助/修复。

【问题讨论】:

    标签: java hadoop apache-pig udf weblog


    【解决方案1】:

    在你的类路径中添加commons-logging jar。它应该可以修复错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-18
      • 1970-01-01
      • 2014-03-22
      • 1970-01-01
      相关资源
      最近更新 更多