Hadoop使用JNI运行java时出错
我尝试运行一个Java程序,该程序利用jni调用Hadoop 2.3.0中的GPU程序,但出现以下错误:Hadoop使用JNI运行java时出错,java,hadoop,java-native-interface,gpu,Java,Hadoop,Java Native Interface,Gpu,我尝试运行一个Java程序,该程序利用jni调用Hadoop 2.3.0中的GPU程序,但出现以下错误: java.lang.Exception: java.lang.UnsatisfiedLinkError: affy.qualityControl.PLM.wlsAcc([D[D[DII)V at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462) at org.apache
java.lang.Exception: java.lang.UnsatisfiedLinkError: affy.qualityControl.PLM.wlsAcc([D[D[DII)V
at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:529)
Caused by: java.lang.UnsatisfiedLinkError: affy.qualityControl.PLM.wlsAcc([D[D[DII)V
at affy.qualityControl.PLM.wlsAcc(Native Method)
at affy.qualityControl.PLM.rlm_fit_anova(PLM.java:141)
at affy.qualityControl.PLM.PLMsummarize(PLM.java:31)
at affy.qualityControl.SummarizePLMReducer.reduce(SummarizePLMReducer.java:59)
at affy.qualityControl.SummarizePLMReducer.reduce(SummarizePLMReducer.java:12)
at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:171)
at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:627)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:389)
at org.apache.hadoop.mapred.LocalJobRunner$Job$ReduceTaskRunnable.run(LocalJobRunner.java:319)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
我猜这个错误是由JNI引起的。我编写了一个小测试Java代码,通过JNI调用我的GPU代码(wlsAcc),它运行良好。我还用我的GPU共享库,每个库都是链接的。我还在MapReduce代码中添加了以下代码(我的GPU代码在Reducer中调用):
我还将libjniwraper.so复制到HDFS的/user/sniu/dir。我仍然不明白为什么hadoop找不到我的本机共享库。有人知道我的问题在哪里吗 现在问题已经解决,问题是对于本机C代码,最初我是这样写的:
JNIEXPORT void JNICALL Java_jniWrapper_wlsAcc
相反,正确的方法应该是:
JNIEXPORT void JNICALL Java_affy_qualityControl_jniWrapper_wlsAcc
JNIEXPORT void JNICALL Java_affy_qualityControl_jniWrapper_wlsAcc