MapReduce中执行HTMLUnit 报nosuchfielderror:INSTANCE

public static class CrawlReducer
extends TableReducer{
private String url = "";
@Override
protected void reduce(Text key, Iterable value, Context context)
throws IOException, InterruptedException{
this.url = key.toString();
final WebClient webClient = new WebClient(BrowserVersion.CHROME);
webClient.getOptions().setCssEnabled(false);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.getOptions().setTimeout(5000);
HtmlPage page = null;
try {
page = webClient.getPage(url);//运行到这句就出错
} catch (FailingHttpStatusCodeException e1) {
e1.printStackTrace();
} catch (MalformedURLException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}

        String s = page.getPage().asXml();
        // Put 实例化,每个词存一行
        Put put = new Put(Bytes.toBytes(url));
        // 列族为 content,列修饰符为 count,列值为数目
        put.add(Bytes.toBytes("content"), Bytes.toBytes("html"),
                Bytes.toBytes(s));
        context.write(NullWritable.get(), put);
    }
    这是Map从Hbase读URL,在reduce里面解析网页过程。运行到getPage就结束了。没币鸟,求大神解脱,好人一生平安

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问