Caused by: java.lang.RuntimeException: No toolkit found

这是运行基于 HBase 的 MapReduce 程序时遇到的一个bug,完整的错误提示信息如下:

Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable p                                ipeline found
        at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
        at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:221)
        at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:205)
        at com.sun.javafx.perf.PerformanceTracker.logEvent(PerformanceTracker.java:110)
        at javafx.scene.Node.<clinit>(Node.java:387)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.apache.hadoop.conf.Configuration.getClassByNameOrNull(Configuration.java:2134)
        at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2099)
        at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2193)
        at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2219)
        at org.apache.hadoop.mapred.JobConf.getMapOutputKeyClass(JobConf.java:813)
        at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapOutputKeyClass(JobContextImpl.java:142)
        at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.addDependencyJars(TableMapReduceUtil.java                                :829)
        at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.jav                                a:206)
        at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.jav                                a:162)
        at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.jav                                a:285)
        at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.jav                                a:86)
        at mr.WordCountMain.main(WordCountMain.java:31)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.apache.hadoop.conf.Configuration.getClassByNameOrNull(Configuration.java:2134)
        at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2099)
        at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2193)
        at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2219)
        at org.apache.hadoop.mapred.JobConf.getMapOutputKeyClass(JobConf.java:813)
        at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapOutputKeyClass(JobContextImpl.java:142)
        at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.addDependencyJars(TableMapReduceUtil.java                                :829)
        at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.jav                                a:206)
        at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.jav                                a:162)
        at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.jav                                a:285)
        at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.initTableMapperJob(TableMapReduceUtil.jav                                a:86)
        at mr.WordCountMain.main(WordCountMain.java:31)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.RuntimeException: No toolkit found
        at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:217)
        at com.sun.javafx.perf.PerformanceTracker.logEvent(PerformanceTracker.java:110)
        at javafx.scene.Node.<clinit>(Node.java:387)
        ... 20 more

原因:包导错了。

Reducer 的输入为 TextIntWritable,由于使用 idea,配置了包自动导入,导致 Text 类导入了这个包下的:import javafx.scene.text.Text,而实际上我们需要导入 import org.apache.hadoop.io.Text 这个包下的。这种错误编译仍然是通过的,这 TM 就很坑…所以,强烈建议大家使用 idea 时关闭自动导包这一功能(尽管本人现在仍然开启的…),否则这种错误真的是很难察觉啊啊啊!!!

ps:这个错误是我通过 Eclipse 打开项目时发现的,发现 import javafx.scene.text.Text 这行变黄,顿悟。

关注我的微信公众号(曲健磊的个人随笔),观看更多精彩内容:
Caused by: java.lang.RuntimeException: No toolkit found_第1张图片

你可能感兴趣的:(【hbase】)