Appengine Mapreduce Restricted Class ManagementFactory

时间:2015-03-20 11:14:36

标签: java google-app-engine mapreduce

当我使用Appengine-mapreduce库触发mapreduce作业时,我得到了一个受限制的类异常。我正在使用appengine sdk版本1.8.8。错误似乎是因为appengine-mapper代码内部使用了hadoop-0.20.2。

java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory is a restricted class. Please see the Google App Engine developer's guide for more details.
    at com.google.apphosting.runtime.security.shared.stub.java.lang.management.ManagementFactory.<clinit>(ManagementFactory.java)
    at org.apache.hadoop.util.ReflectionUtils.<clinit>(ReflectionUtils.java:121)
    at org.apache.hadoop.io.serializer.SerializationFactory.add(SerializationFactory.java:64)
    at org.apache.hadoop.io.serializer.SerializationFactory.<init>(SerializationFactory.java:54)
    at com.google.appengine.tools.mapreduce.SerializationUtil.serializeToByteArrayOutputStream(SerializationUtil.java:46)
    at com.google.appengine.tools.mapreduce.SerializationUtil.serializeToByteArray(SerializationUtil.java:60)
    at com.google.appengine.tools.mapreduce.v2.impl.ShardState.setInputSplit(ShardState.java:215)
    at com.google.appengine.tools.mapreduce.v2.impl.handlers.Worker.scheduleShards(Worker.java:218)
    at com.google.appengine.tools.mapreduce.v2.impl.handlers.Controller.handleStart(Controller.java:133)

触发代码:

MapReduceXml mrXml = MapReduceXml.getMapReduceXmlFromFile();
Configuration configuration = mrXml.instantiateConfiguration( configName, params );

jobId = Controller.handleStart(configuration, configName, "/mapreduce/");

请指教!!

1 个答案:

答案 0 :(得分:2)

使用随appengine-mapper一起提供的hadoop-0.20.2-core.jar后,此问题得到了解决。它似乎不喜欢来自maven的hadoop-core-0.20.2文件。