运行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
最满意答案
查看文档 ,没有明确的命令来清除值历史记录。
它确实提到了可以更改符号表的
file
和symbol-file
命令,可以清除历史记录。此外,您可以使用
output
而不是Looking at the documentation, there's no explicit command to clear the value history.
It does mention that the
file
andsymbol-file
commands, which can change the symbol table, clear the history.Also, you can use
output
instead of
相关问答
更多-
一般的解决方案是不用动态名称创建变量,而是创建一个映射。 具体如何完成将因语言而异。 对于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 ...
-
变量的命名约定(Naming Conventions for Variables)[2022-10-08]
你在代码片段中列出的是命名约定。 更重要的问题是,如何重新构建可读性? 作为没有看到您的节目的人,您列出的四项功能似乎对我来说非常清楚。 我很难弄清楚一些事情。 任何时候你放弃一个约定,即使这个约定让事情变得恶心,你也会失去可读性/清晰性(正如人们期望的那样,这些约定被实现了)。 你必须权衡放弃恶习的好处 - 更好地避免放弃惯例。 所有这一切都说,你有我的许可使用'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)] 虽然有其他一些案例,但他们都是这样的。 请注意,没有任何 ...
-
在for循环中命名变量(Naming variables in for loop)[2023-07-19]
将您的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 ... -
在GDB中命名断点(Naming breakpoints in GDB)[2023-02-21]
不,没有办法做到这一点,但你可以使用'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 ...
-
您是否使用特定约定来命名互补变量?(Do you use particular conventions for naming complementary variables?)[2022-04-10]
与各种代码样式约定一样, 一致性是您应该努力的方向。 我希望开发团队就“源/目的地”或“从/到”等常见场景的“标准”前缀对达成一致,然后在整个项目中坚持使用它们。 只要每个开发人员都知道代码库中特定前缀的含义,就可以更容易地避免误解。 如果变量是公共API的一部分,或者在代码中的注释中,如果可见性仅限于单个类或方法,则应在文档中阐明规则的例外情况。 Like with all kinds of code style conventions, consistency is what you should st ... -
golang gdb - 打印变量(golang gdb - print variables)[2023-09-18]
添加到@ 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, ...