1、java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration

  1. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration
  2. at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:108)
  3. at org.apache.gora.store.DataStoreFactory.initializeDataStore(DataStoreFactory.java:102)
  4. at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:161)
  5. at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:135)
  6. at org.apache.nutch.storage.StorageUtils.createWebStore(StorageUtils.java:75)
  7. at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:221)
  8. at org.apache.nutch.crawl.Crawler.runTool(Crawler.java:68)
  9. at org.apache.nutch.crawl.Crawler.run(Crawler.java:136)
  10. at org.apache.nutch.crawl.Crawler.run(Crawler.java:250)
  11. at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
  12. at org.apache.nutch.crawl.Crawler.main(Crawler.java:257)
  13. Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration
  14. at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
  15. at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
  16. at java.security.AccessController.doPrivileged(Native Method)
  17. at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
  18. at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
  19. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
  20. at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
  21. ... 11 more
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration
at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:108)
at org.apache.gora.store.DataStoreFactory.initializeDataStore(DataStoreFactory.java:102)
at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:161)
at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:135)
at org.apache.nutch.storage.StorageUtils.createWebStore(StorageUtils.java:75)
at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:221)
at org.apache.nutch.crawl.Crawler.runTool(Crawler.java:68)
at org.apache.nutch.crawl.Crawler.run(Crawler.java:136)
at org.apache.nutch.crawl.Crawler.run(Crawler.java:250)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.nutch.crawl.Crawler.main(Crawler.java:257)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 11 more

官方文档说明如下:

  1. N.B. It's possible to encounter the following exception: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration; this is caused by the fact that sometimes the hbase TEST jar is deployed in the lib dir. To resolve this just copy the lib over from your installed HBase dir into the build lib dir. (This issue is currently in progress).
N.B. It's possible to encounter the following exception: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration; this is caused by the fact that sometimes the hbase TEST jar is deployed in the lib dir. To resolve this just copy the lib over from your installed HBase dir into the build lib dir. (This issue is currently in progress).

解决方法:

我们把$HBASE_HOME/lib下的所有包,拷贝到$NUTCH_HOME/runtime/local/lib目录下。运行即可

2、java.lang.NoSuchMethodError:org.apache.hadoop.hbase.HColumnDescriptor.setMaxVersions(I)V

HBASE官方JIRA BUG编号:HBASE-8273

这个是HBASE-5357引入的问题,原因是HBASE-5357将HColumnDescriptor.setMaxVersions
返回值修改成返回​​HColumnDescriptor,而不是返回void,所以改变了​​HColumnDescriptor setMaxVersions
方法的签名。所以它只会得到与Integer.intValue编译仍然不会找到setMaxVersions(INT)

Cloudera 官网说明

  1. Column family manipulations are binary-incompatible between CDH4.2 and CDH4.0/CDH4.1
  2. Because of HBASE-5357, code compiled against CDH4.0 and CDH4.1 will fail with java.lang.NoSuchMethodError: org.apache.hadoop.hbase.HColumnDescriptor.setMaxVersions(I)V, if used with the CDH4.2 libraries. The reason is that the setter methods in HColumnDescriptor were modified to return HColumnDescriptor instead of void, which changes their signature. Code that only does data manipulations, using the HTable class, will still work without recompilation.
  3. Bug: HBASE-8273
  4. Severity: Medium
  5. Anticipated Resolution: None planned; use workaround.
  6. Workaround: Code compiled against CDH4.0 and 4.1 that uses HColumnDescriptor must be recompiled against CDH4.2 in order to work with the CDH4.2 libraries. Code compiled against CDH4.0 and CDH4.1 running with those libraries does not have this problem.
Column family manipulations are binary-incompatible between CDH4.2 and CDH4.0/CDH4.1
Because of HBASE-5357, code compiled against CDH4.0 and CDH4.1 will fail with java.lang.NoSuchMethodError: org.apache.hadoop.hbase.HColumnDescriptor.setMaxVersions(I)V, if used with the CDH4.2 libraries. The reason is that the setter methods in HColumnDescriptor were modified to return HColumnDescriptor instead of void, which changes their signature. Code that only does data manipulations, using the HTable class, will still work without recompilation. Bug: HBASE-8273 Severity: Medium Anticipated Resolution: None planned; use workaround. Workaround: Code compiled against CDH4.0 and 4.1 that uses HColumnDescriptor must be recompiled against CDH4.2 in order to work with the CDH4.2 libraries. Code compiled against CDH4.0 and CDH4.1 running with those libraries does not have this problem.

原因:这边我使用的hadoop和hbase启动是没有问题的,也就是说是gora-hbase插件的问题

解决方法:

将gora-hbase插件中涉及使用到HColumnDescriptor的代码重新编译可解决。

具体要编译那些类后续会列出

3、java.lang.ClassNotFoundException: org.apache.gora.hbase.store.HBaseStore

  1. hadoop@nutch1:/data/projects/apache-nutch-2.2.1/runtime/local$ bin/nutch crawl urls/seed.txt -dir crawl -depth 3 -topN 5
  2. Exception in thread "main" java.lang.ClassNotFoundException: org.apache.gora.hbase.store.HBaseStore
  3. at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
  4. at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
  5. at java.security.AccessController.doPrivileged(Native Method)
  6. at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
  7. at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
  8. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
  9. at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
  10. at java.lang.Class.forName0(Native Method)
  11. at java.lang.Class.forName(Class.java:188)
  12. at org.apache.nutch.storage.StorageUtils.getDataStoreClass(StorageUtils.java:89)
  13. at org.apache.nutch.storage.StorageUtils.createWebStore(StorageUtils.java:73)
  14. at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:221)
  15. at org.apache.nutch.crawl.Crawler.runTool(Crawler.java:68)
  16. at org.apache.nutch.crawl.Crawler.run(Crawler.java:136)
  17. at org.apache.nutch.crawl.Crawler.run(Crawler.java:250)
  18. at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
  19. at org.apache.nutch.crawl.Crawler.main(Crawler.java:257)
hadoop@nutch1:/data/projects/apache-nutch-2.2.1/runtime/local$ bin/nutch crawl urls/seed.txt -dir crawl -depth 3 -topN 5
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.gora.hbase.store.HBaseStore
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at org.apache.nutch.storage.StorageUtils.getDataStoreClass(StorageUtils.java:89)
at org.apache.nutch.storage.StorageUtils.createWebStore(StorageUtils.java:73)
at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:221)
at org.apache.nutch.crawl.Crawler.runTool(Crawler.java:68)
at org.apache.nutch.crawl.Crawler.run(Crawler.java:136)
at org.apache.nutch.crawl.Crawler.run(Crawler.java:250)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.nutch.crawl.Crawler.main(Crawler.java:257)

解决方法:

方法1:下载gora-0.3,然后对该目录下的gora-hbase进行编译生成gora-hbase.jar,然后将jar包放到$NUTCH/runtime/local/lib目录下

方法2:修改$NUTCH_HOME/ivy/ivy.xml

将<dependency org="org.apache.gora" name="gora-hbase"
rev="0.3" conf="*->default" />去掉注释。然后再重新编译一次。这样ivy会为你生成gora-hbase的插件

4、java.lang.NullPointerException

  1. java.lang.NullPointerException
  2. at org.apache.avro.util.Utf8.<init>(Utf8.java:37)
  3. at org.apache.nutch.crawl.GeneratorReducer.setup(GeneratorReducer.java:100)
  4. at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:174)
  5. at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:649)
  6. at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:418)
  7. at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:398)
 java.lang.NullPointerException
at org.apache.avro.util.Utf8.<init>(Utf8.java:37)
at org.apache.nutch.crawl.GeneratorReducer.setup(GeneratorReducer.java:100)
at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:174)
at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:649)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:418)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:398)

查看GeneratorReducer第100行代码如下:

batchId = newUtf8(conf.get(GeneratorJob.BATCH_ID));

可以看到是获取GeneratorJob.BATCH_ID。也就是generate.batch.id这个值的时候报空了!

解决方法:

方法1:
在nutch-site.xml中添加generate.batch.id配置项,value不为空即可;但是这种做法不是很好,因为查看源码里面batchId是用随机数生成的。可能有其他地方有限制。
方法2:

修改GeneratorJob中的public Map<String,Object> run(Map<String,Object> args) 方法。

添加以下三行

  1. // generate batchId
  2. int randomSeed = Math.abs(new Random().nextInt());
  3. String batchId = (curTime / 1000) + "-" + randomSeed;
  4. getConf().set(BATCH_ID, batchId);
 // generate batchId
int randomSeed = Math.abs(new Random().nextInt());
String batchId = (curTime / 1000) + "-" + randomSeed;
getConf().set(BATCH_ID, batchId);

【Apache Nutch系列】Nutch2.0配置安装异常集锦的更多相关文章

  1. Apache Maven 3.5.0配置安装

    1.maven 3.5 下载地址:http://maven.apache.org/download.cgi 2.下载了解压到 3.配置环境变量 4.测试看是否安装成功 5.maven配置(全局配置,用 ...

  2. Apache Maven 3.6.1配置安装

    Apache Maven 3.6.1配置安装 一.下载 maven下载地址:http://maven.apache.org/download.cgi 二.安装 1,解压即可用 2,环境变量配置 MAV ...

  3. Apache Maven 3.6.3配置安装

    1.maven 3.5 下载地址:http://maven.apache.org/download.cgi 2.下载了解压到 3.配置环境变量 4.测试看是否安装成功 5.maven配置(全局配置,用 ...

  4. windows Server2012 之 IIS8.0配置安装完整教程

    IIS8.0是windows Server2012自带的服务器管理系统,和以往不同,IIS8.0安装和操作都比较简单,界面很简洁,安装也很迅速.今天我们重点完整的演示下Internet Informa ...

  5. windows Server2012 IIS8.0配置安装完整教程

    IIS8.0是windows Server2012自带的服务器管理系统,和以往不同,IIS8.0安装和操作都比较简单,界面很简洁,安装也很迅速.今天我们重点完整的演示下Internet Informa ...

  6. 【Apache KafKa系列之一】KafKa安装部署

    kafka是一种高吞吐量的分布式发布订阅消息系统,她有如下特性: 通过O(1)的磁盘数据结构提供消息的持久化,这种结构对于即使数以TB的消息存储也能够保持长时间的稳定性能. 高吞吐量:即使是非常普通的 ...

  7. RedHat下apache\ftp\mysql 4.0 的安装方法

    RedHat下安装这三个服务的方法大同小异 Apache服务: 找到Apache安装包: rpm -ivh httpd-2.0.40-21.i386.rpm 等待安装完成即可 检查安装结果: rpm ...

  8. 【转】Oozie4.2.0配置安装实战

    什么是Oozie? Oozie是一种Java Web应用程序,它运行在Java servlet容器——即Tomcat——中,并使用数据库来存储以下内容: 工作流定义 当前运行的工作流实例,包括实例的状 ...

  9. Oozie4.2.0配置安装实战

    软件版本号: Oozie4.2.0.Hadoop2.6.0,Spark1.4.1.Hive0.14.Pig0.15.0.Maven3.2.JDK1.7,zookeeper3.4.6.HBase1.1. ...

随机推荐

  1. Choosing Capital for Treeland CodeForces - 219D (树形DP)

    传送门 The country Treeland consists of n cities, some pairs of them are connected with unidirectional  ...

  2. [Codeforces958F2]Lightsabers (medium)(思维)

    Description 题目链接 Solution 设一个l指针指向当前数列左边,从左往右扫描一遍,将当前颜色记录, 当所有颜色都得到后,进行判断,如果当前l指向的颜色大于需要的颜色,l后移一位,然后 ...

  3. 可以字符串string转化成list,tuple,dict的eval()方法

    功能:将字符串str当成有效的表达式来求值并返回计算结果. 语法: eval(source[, globals[, locals]]) -> value 参数: source:一个Python表 ...

  4. java线程安全(单例模式)(转载)

    原文链接:http://www.jameswxx.com/java/%E8%AF%B4%E8%AF%B4%E5%8D%95%E4%BE%8B%E6%A8%A1%E5%BC%8F/ 单例模式?多么简单! ...

  5. 1 web应用

    web应用 Web应用程序是一种可以通过Web访问的应用程序,程序的最大好处是用户很容易访问应用程序,用户只需要有浏览器即可,不需要再安装其他软件.应用程序有两种模式C/S.B/S.C/S是客户端/服 ...

  6. ElasticSearch学习笔记(五)-- 排序、分页与遍历

    1. 相关性算分 这样能够查询到不同分片上的文档的准确算分,默认分片为5 2. sorting-doc-values-fielddata 3. 分页与遍历

  7. Android学习记录(6)—将java中的多线程下载移植到Android中(即多线程下载在Android中的使用)③

    在这一节中,我们就来讲多线程下载以及断点续传在android中怎么使用,前两节是为本节做准备的,没有看前两节的同学,最好看完前面的两篇文章再来看这篇.其实在android端的应用和java基本上是差不 ...

  8. Lazarus教程 中文版后续给出

    市面上有介绍Delphi的书籍(近来Delphi的书也是越来越少了),但没有一本系统的介绍Lazarus的书,这本书是网上的仅有的一本Lazarus教程,目前全部是英文,不过我已经着手开始翻译,争取尽 ...

  9. PyCharm 解决有些库(函数)没有代码提示

    问题描述: 如图,当输入 im. 没有智能提示第三库相应的函数或其他提示. 解决方案: python是动态强类型语言,IDE无法判断Image.open("panda.png")的 ...

  10. obj = object(),所创建的obj实例到底是个啥?

    In[1]: dir(obj) Out[1]:['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '_ ...