首页 \ 问答 \ 运行Kafka hadoop-consumer时出现ClassNotFoundException(ClassNotFoundException while running Kafka hadoop-consumer)

运行Kafka hadoop-consumer时出现ClassNotFoundException(ClassNotFoundException while running Kafka hadoop-consumer)

我是Kafka的新手,我正在测试hortonworks sanbox 2.3。 我正在https://github.com/kafka-dev/kafka/tree/master/contrib/hadoop-consumer上关注kafka教程。

运行./run-class.sh kafka.etl.impl.DataGenerator test / test.properties时出错

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
        at java.lang.Class.getMethod0(Class.java:2856)
        at java.lang.Class.getMethod(Class.java:1668)
        at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
        at  sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.conf.Configuration
        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:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 6 more

我已经在run-class.sh中包含了所有可能的kafka jar但仍然没有运气。 请帮忙!


I'm new to Kafka and I'm test on hortonworks sanbox 2.3. I'm following kafka tutorial at https://github.com/kafka-dev/kafka/tree/master/contrib/hadoop-consumer.

When running ./run-class.sh kafka.etl.impl.DataGenerator test/test.properties, I get error

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
        at java.lang.Class.getMethod0(Class.java:2856)
        at java.lang.Class.getMethod(Class.java:1668)
        at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
        at  sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.conf.Configuration
        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:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 6 more

I already include all possible kafka jar in run-class.sh but still no luck. Please help!


原文:https://stackoverflow.com/questions/33160550
更新时间:2022-08-06 08:08

最满意答案

查看文档 ,没有明确的命令来清除值历史记录。

它确实提到了可以更改符号表的filesymbol-file命令,可以清除历史记录。

此外,您可以使用output而不是print来避免将打印值放入值历史记录中。


Looking at the documentation, there's no explicit command to clear the value history.

It does mention that the file and symbol-file commands, which can change the symbol table, clear the history.

Also, you can use output instead of print to avoid putting the printed value in the value history.

相关问答

更多
  • 一般的解决方案是不用动态名称创建变量,而是创建一个映射。 具体如何完成将因语言而异。 对于Java,值得一看Sun系列教程的地图部分 。 The general solution to this is to not create variables with dynamic names, but to instead create a map. Exactly how that's done will vary by language. For Java, it's worth looking at the ...
  • 你在代码片段中列出的是命名约定。 更重要的问题是,如何重新构建可读性? 作为没有看到您的节目的人,您列出的四项功能似乎对我来说非常清楚。 我很难弄清楚一些事情。 任何时候你放弃一个约定,即使这个约定让事情变得恶心,你也会失去可读性/清晰性(正如人们期望的那样,这些约定被实现了)。 你必须权衡放弃恶习的好处 - 更好地避免放弃惯例。 所有这一切都说,你有我的许可使用'getXvel()'。 一帆风顺。 =) What you've listed in your code snippet is the nami ...
  • 基于我对你想做什么的理解,不,你做不到。 您无法在列表推导中执行任务,因为列表理解基本上是表单 [expression(x, y) for x in expression_that_creates_a_container for y in some_other_expression_that_creates_a_container(x) if predicate(y, x)] 虽然有其他一些案例,但他们都是这样的。 请注意,没有任何 ...
  • 将您的javascript代码包含在document.ready函数下面,以便它只在您的页面准备就绪时执行。 $(document).ready(function () { // enter your code here }); Enclose your javascript code in below document.ready function, so that it will execute only when your page is ready. $(document).ready(f ...
  • 不,没有办法做到这一点,但你可以使用'commands'命令和print命令。 例如 break main commands print "!!!VERYIMPORTANTBREAKPOINT!!! in method main()" end no, there is no way to do this, but you can use the 'commands' command, and the print command. e.g. break main commands print "!!!VER ...
  • 如果: 你的功能/方法写得很好,并且很短(因为它们应该是) 变量名称足够描述 这种做法是不需要的。 如果你需要这个,这意味着写的代码不够可读(函数/方法太长),神秘的变量/函数名称,不好的面向对象的做法,快捷方式,代码债务等。 所以这将是一个信号,代码需要重构/改进。 If : your functions/methods are well written and short (as they should be) the variable names are descriptive enough This ...
  • 我认为你误解了变量定义的工作原理。 创建变量名称时,必须知道如何调用它,不能动态define名称。 也许用于存储绑定的哈希表将是有用的,它有点类似于你所要求和模拟动态定义的变量 - 但我仍然不确定你为什么要这样做,听起来更像是我的XY问题 。 尝试这个: (define (create-key var1 var2) (string->symbol (string-append "variable-" (number->string var1) "-" (numbe ...
  • 查看文档 ,没有明确的命令来清除值历史记录。 它确实提到了可以更改符号表的file和symbol-file命令,可以清除历史记录。 此外,您可以使用output而不是print来避免将打印值放入值历史记录中。 Looking at the documentation, there's no explicit command to clear the value history. It does mention that the file and symbol-file commands, which can ...
  • 与各种代码样式约定一样, 一致性是您应该努力的方向。 我希望开发团队就“源/目的地”或“从/到”等常见场景的“标准”前缀对达成一致,然后在整个项目中坚持使用它们。 只要每个开发人员都知道代码库中特定前缀的含义,就可以更容易地避免误解。 如果变量是公共API的一部分,或者在代码中的注释中,如果可见性仅限于单个类或方法,则应在文档中阐明规则的例外情况。 Like with all kinds of code style conventions, consistency is what you should st ...
  • 添加到@ AlexAtNet的答案,Go 1.2.x之后的所有内容都打破了GDB支持,所以要么使用去1.2.x进行调试或使用gccgo(请记住gcc 4.8.x支持go 1.1,gcc 4.9.x高达1.2) 。 另一个选择是使用你自己的跟踪功能,不是很漂亮,但它是目前唯一真正的调试选项,适用于1.3+。 我个人使用这样的东西进行调试: var traceLock sync.Mutex func trace(a ...interface{}) { traceLock.Lock() pc, ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)