2

在 java spark 中处理 protobuf bytearray 消息时出现以下错误。

ThrowableSerializationWrapper:无法反序列化任务异常 java.lang.RuntimeException:找不到原型缓冲区类

SparkConf sparkConf = new SparkConf();
sparkConf.setAppName(applicationName);
sparkConf.setMaster(sparkMasterUrl);
sparkConf.set(ALLOW_MULTI_CONTEXT, "true");
sparkConf.set(INPUT_WITHOUT_EXTENSION, "false");
sparkConf.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer");
sparkConf.set("spark.kryo.registrator", ProtoBufRegistrator.class.getName());
SparkContext sc = new SparkContext(sparkConf);
//Create a Java Context which is the same as the scala one under the hood
JavaSparkContext jsc = JavaSparkContext.fromSparkContext(sc);
HiveContext hiveContext = new org.apache.spark.sql.hive.HiveContext(jsc);
DataFrame dataFrame = sqlContext.read().format(SPARK_AVRO_FORMAT).load(inputFileName);
JavaRDD<List<Object>> jRDD = dataFrame.javaRDD().map(new ParseRawMessage());
jRDD.count()

ParseRaw 消息:

returns ProtobufMessage.parseFrom(byteArray);

ProtoBuf注册器:

public static class ProtoBufRegistrator implements KryoRegistrator {
        @Override
        public void registerClasses(Kryo kryo) {
            kryo.register(ProtobufMessage.class, new FieldSerializer<Object>(kryo, ProtobufMessage.class));
        }
      }

堆栈跟踪:

WARN ThrowableSerializationWrapper: Task exception could not be deserialized java.lang.RuntimeException: Unable to find proto buffer class  at com.google.protobuf.GeneratedMessageLite$SerializedForm.readResolve(GeneratedMessageLite.java:775)   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:497)     at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1104)     at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1810)    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)     at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)     at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:501)  at java.lang.Throwable.readObject(Throwable.java:914)   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:497)     at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)  at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)   at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)     at org.apache.spark.ThrowableSerializationWrapper.readObject(TaskEndReason.scala:175)   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:497)     at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)  at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)     at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)     at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)   at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)     at org.apache.spark.serializer.JavaDeserializationStream.readObject(JavaSerializer.scala:76)    at org.apache.spark.serializer.JavaSerializerInstance.deserialize(JavaSerializer.scala:115)     at org.apache.spark.scheduler.TaskResultGetter$$anon$3$$anonfun$run$2.apply$mcV$sp(TaskResultGetter.scala:109)  at org.apache.spark.scheduler.TaskResultGetter$$anon$3$$anonfun$run$2.apply(TaskResultGetter.scala:105)     at org.apache.spark.scheduler.TaskResultGetter$$anon$3$$anonfun$run$2.apply(TaskResultGetter.scala:105)     at org.apache.spark.util.Utils$.logUncaughtExceptions(Utils.scala:1801)     at org.apache.spark.scheduler.TaskResultGetter$$anon$3.run(TaskResultGetter.scala:105)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: com.ProtobufMessage$ProtobufMessage   at java.net.URLClassLoader.findClass(URLClassLoader.java:381)   at java.lang.ClassLoader.loadClass(ClassLoader.java:424)    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)    at java.lang.Class.forName0(Native Method)  at java.lang.Class.forName(Class.java:264)  at com.google.protobuf.GeneratedMessageLite$SerializedForm.readResolve(GeneratedMessageLite.java:768)   ... 51 more

Spark 提交日志:

17/10/25 14:30:05 INFO Client: Requesting a new application from
cluster with 113 NodeManagers 17/10/25 14:30:05 INFO Client: Verifying our application has not requested more than the maximum memory capability of the cluster (29696 MB per container) 17/10/25 14:30:05 INFO Client: Will allocate AM container, with 16610 MB memory including 1250 MB overhead 17/10/25 14:30:05 INFO Client: Setting up container launch context for our AM 17/10/25 14:30:05 INFO Client: Setting up the launch environment for our AM container 17/10/25 14:30:05 INFO Client: Using the spark assembly jar on HDFS because you are using HDP, defaultSparkAssembly:hdfs://<hdfs>/hdp/apps/2.5.0.55-1/spark/spark-hdp-assembly.jar 17/10/25 14:30:05 INFO Client: Preparing resources for our AM container 17/10/25 14:30:05 INFO Client: Using the spark assembly jar on HDFS because you are using HDP, defaultSparkAssembly:hdfs://<hdfs>/hdp/apps/2.5.0.55-1/spark/spark-hdp-assembly.jar 17/10/25 14:30:05 INFO Client: Source and destination file systems are the same. Not copying hdfs://<hdfs>/hdp/apps/2.5.0.55-1/spark/spark-hdp-assembly.jar 17/10/25 14:30:05 INFO Client: Uploading resource file:/hadoopfs/fs1/home/user/avro_kafka_producer/adl-ingestion-avro-kafka-producer-1.2.0-SNAPSHOT.jar
hdfs://<hdfs>/user/user/.sparkStaging/application_1508179668025_159929/adl-ingestion-avro-kafka-producer-1.2.0-SNAPSHOT.jar 17/10/25 14:30:10 INFO Client: Uploading resource file:/hadoopfs/fs1/services/hdp/2.5.0.55-1/spark/lib/datanucleus-api-jdo-3.2.6.jar
 hdfs://<hdfs>/user/user/.sparkStaging/application_1508179668025_159929/datanucleus-api-jdo-3.2.6.jar 17/10/25 14:30:10 INFO Client: Uploading resource file:/hadoopfs/fs1/services/hdp/2.5.0.55-1/spark/lib/datanucleus-rdbms-3.2.9.jar
   hdfs://<hdfs>/user/user/.sparkStaging/application_1508179668025_159929/datanucleus-rdbms-3.2.9.jar 17/10/25 14:30:10 INFO Client: Uploading resource file:/hadoopfs/fs1/services/hdp/2.5.0.55-1/spark/lib/datanucleus-core-3.2.10.jar
   hdfs://<hdfs>/user/user/.sparkStaging/application_1508179668025_159929/datanucleus-core-3.2.10.jar 17/10/25 14:30:10 INFO Client: Uploading resource file:/tmp/spark-b971d920-cd45-48d1-ad6b-409cf8f35f6f/__spark_conf__2464955163016603937.zip
hdfs://<hdfs>/user/user/.sparkStaging/application_1508179668025_159929/__spark_conf__2464955163016603937.zip 17/10/25 14:30:10 INFO SecurityManager: Changing view acls to: user 17/10/25 14:30:10 INFO SecurityManager: Changing modify acls to: user 17/10/25 14:30:10 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(user); users with modify permissions: Set(user) 17/10/25 14:30:10 INFO Client: Submitting application 159929 to ResourceManager 17/10/25 14:30:10 INFO YarnClientImpl: Submitted application application_1508179668025_159929 17/10/25 14:30:11 INFO Client: Application report for application_1508179668025_159929 (state: ACCEPTED)

打印类路径:

/hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/appcache/application_1508179668025_159929/container_e70_1508179668025_159929_01_000001/adl-ingestion-avro-kafka-producer-1.2.0-SNAPSHOT.jar /hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/appcache/application_1508179668025_159929/container_e70_1508179668025_159929_01_000001/ /hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/filecache/13496/__spark_conf__2464955163016603937.zip/ /hadoopfs/fs10/yarn/nodemanager/filecache/235/spark-hdp-assembly.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/hadoop-auth-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/hadoop-common-2.7.3.2.5.0.55-1-tests.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/hadoop-aws-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/paranamer-2.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/zookeeper-3.4.6.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jackson-xc-1.9.13.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-net-3.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-lang-2.6.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jaxb-impl-2.2.3-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/hamcrest-core-1.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jsr305-3.0.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-beanutils-core-1.8.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jersey-server-1.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-configuration-1.6.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jackson-jaxrs-1.9.13.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jsp-api-2.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/xmlenc-0.52.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/httpcore-4.4.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/apacheds-kerberos-codec-2.0.0-M15.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/aws-java-sdk-core-1.10.6.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/ranger-hdfs-plugin-shim-0.6.0.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jetty-util-6.1.26.hwx.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/protobuf-java-2.5.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/apacheds-i18n-2.0.0-M15.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/avro-1.7.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jersey-json-1.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-compress-1.4.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-codec-1.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-beanutils-1.7.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/httpclient-4.5.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/snappy-java-1.0.4.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/curator-client-2.7.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/slf4j-api-1.7.10.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/ojdbc6.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-cli-1.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/azure-storage-2.2.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jackson-databind-2.2.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-collections-3.2.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/curator-recipes-2.7.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/stax-api-1.0-2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-io-2.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/nimbus-jose-jwt-3.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jettison-1.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jetty-6.1.26.hwx.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/ranger-yarn-plugin-shim-0.6.0.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/junit-4.11.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/api-util-1.0.0-M20.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/aws-java-sdk-kms-1.10.6.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/log4j-1.2.17.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/slf4j-log4j12-1.7.10.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jackson-core-2.2.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jackson-mapper-asl-1.9.13.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jersey-core-1.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jaxb-api-2.2.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/netty-3.6.2.Final.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-logging-1.1.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jsch-0.1.42.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jets3t-0.9.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/mockito-all-1.8.5.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/api-asn1-api-1.0.0-M20.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jackson-annotations-2.2.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-digester-1.8.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/servlet-api-2.5.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/java-xmlbuilder-0.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/aws-java-sdk-s3-1.10.6.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/microsoft-windowsazure-storage-sdk-0.6.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/activation-1.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/commons-math3-3.1.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/xz-1.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/json-smart-1.1.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jackson-core-asl-1.9.13.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/asm-3.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/ranger-plugin-classloader-0.6.0.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/joda-time-2.8.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/guava-11.0.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/htrace-core-3.1.0-incubating.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/curator-framework-2.7.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/gson-2.2.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/jcip-annotations-1.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/hadoop-hdfs-2.7.3.2.5.0.55-1-tests.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/hadoop-hdfs-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/hadoop-hdfs-nfs-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/hadoop-hdfs-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/hadoop-hdfs-nfs-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/hadoop-hdfs-2.7.3.2.5.0.55-1-tests.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/commons-lang-2.6.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/commons-daemon-1.0.13.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/netty-all-4.0.23.Final.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/jsr305-3.0.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/jersey-server-1.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/xmlenc-0.52.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/jetty-util-6.1.26.hwx.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/protobuf-java-2.5.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/xml-apis-1.3.04.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/commons-codec-1.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/okhttp-2.4.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/commons-cli-1.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/commons-io-2.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/jetty-6.1.26.hwx.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/log4j-1.2.17.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/jackson-mapper-asl-1.9.13.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/jersey-core-1.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/netty-3.6.2.Final.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/commons-logging-1.1.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/leveldbjni-all-1.8.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/servlet-api-2.5.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/jackson-core-asl-1.9.13.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/asm-3.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/guava-11.0.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/xercesImpl-2.9.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/htrace-core-3.1.0-incubating.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-hdfs/lib/okio-1.4.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-resourcemanager-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-applications-distributedshell-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-applicationhistoryservice-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-nodemanager-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-timeline-pluginstorage-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-registry-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-client-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-common-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-common-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-applicationhistoryservice-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-web-proxy-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-web-proxy-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-applications-distributedshell-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-api-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-tests-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-api-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-common-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-sharedcachemanager-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-client-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-timeline-pluginstorage-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-common-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-nodemanager-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-resourcemanager-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-tests-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-server-sharedcachemanager-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-registry-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.7.3.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/paranamer-2.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/zookeeper-3.4.6.2.5.0.55-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jackson-xc-1.9.13.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-net-3.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-lang-2.6.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jaxb-impl-2.2.3-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/fst-2.24.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/guice-servlet-3.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jsr305-3.0.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-beanutils-core-1.8.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jersey-server-1.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-configuration-1.6.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/metrics-core-3.0.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jackson-jaxrs-1.9.13.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/javassist-3.18.1-GA.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jsp-api-2.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/xmlenc-0.52.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/objenesis-2.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/httpcore-4.4.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/apacheds-kerberos-codec-2.0.0-M15.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jetty-util-6.1.26.hwx.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/protobuf-java-2.5.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/apacheds-i18n-2.0.0-M15.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/avro-1.7.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jersey-json-1.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-compress-1.4.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-codec-1.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-beanutils-1.7.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/httpclient-4.5.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/snappy-java-1.0.4.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/curator-client-2.7.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jersey-client-1.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/javax.inject-1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-cli-1.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jackson-databind-2.2.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-collections-3.2.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/curator-recipes-2.7.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/stax-api-1.0-2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/zookeeper-3.4.6.2.5.0.55-1-tests.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-io-2.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/nimbus-jose-jwt-3.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jettison-1.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jetty-6.1.26.hwx.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/api-util-1.0.0-M20.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jersey-guice-1.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/log4j-1.2.17.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jackson-core-2.2.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/guice-3.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jackson-mapper-asl-1.9.13.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jersey-core-1.9.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jaxb-api-2.2.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/netty-3.6.2.Final.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-logging-1.1.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jsch-0.1.42.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jets3t-0.9.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/api-asn1-api-1.0.0-M20.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jackson-annotations-2.2.3.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/leveldbjni-all-1.8.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-digester-1.8.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/servlet-api-2.5.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/java-xmlbuilder-0.4.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/microsoft-windowsazure-storage-sdk-0.6.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/activation-1.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/commons-math3-3.1.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/xz-1.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/json-smart-1.1.1.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jackson-core-asl-1.9.13.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/asm-3.2.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/aopalliance-1.0.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/htrace-core-3.1.0-incubating.jar /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop-yarn/lib/jcip-annotations-1.0.jar /hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/appcache/application_1508179668025_159929/container_e70_1508179668025_159929_01_000001/mr-framework/hadoop/share/hadoop/mapreduce/* /hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/appcache/application_1508179668025_159929/container_e70_1508179668025_159929_01_000001/mr-framework/hadoop/share/hadoop/mapreduce/lib/* /hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/appcache/application_1508179668025_159929/container_e70_1508179668025_159929_01_000001/mr-framework/hadoop/share/hadoop/common/* /hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/appcache/application_1508179668025_159929/container_e70_1508179668025_159929_01_000001/mr-framework/hadoop/share/hadoop/common/lib/* /hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/appcache/application_1508179668025_159929/container_e70_1508179668025_159929_01_000001/mr-framework/hadoop/share/hadoop/yarn/* /hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/appcache/application_1508179668025_159929/container_e70_1508179668025_159929_01_000001/mr-framework/hadoop/share/hadoop/yarn/lib/* /hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/appcache/application_1508179668025_159929/container_e70_1508179668025_159929_01_000001/mr-framework/hadoop/share/hadoop/hdfs/* /hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/appcache/application_1508179668025_159929/container_e70_1508179668025_159929_01_000001/mr-framework/hadoop/share/hadoop/hdfs/lib/* /hadoopfs/fs6/yarn/nodemanager/usercache/user_prod/appcache/application_1508179668025_159929/container_e70_1508179668025_159929_01_000001/mr-framework/hadoop/share/hadoop/tools/lib/* /hadoopfs/fs1/services/hdp/2.5.0.55-1/hadoop/lib/hadoop-lzo-0.6.0.2.5.0.55-1.jar
4

1 回答 1

1

看起来你已经正确地完成了它,它是一个类路径问题,其中 protobuf 正确版本的 jar 不在类路径中,请参阅下面的问题并得到解决..
http://apache-spark-user-list.1001560.n3.nabble。 com/Unable-to-find-proto-buffer-class-error-with-RDD-lt-protobuf-gt-td14529.html

使用下面打印当前运行代码下的所有类路径资源以了解

1) 您是否使用正确版本的 protobuf jar (可能 >=2.5) 或
2) 类路径中存在任何重复的 protobufjar...

import java.net.URL;

import java.net.URLClassLoader;
...



ClassLoader cl = ClassLoader.getSystemClassLoader();

    URL[] urls = ((URLClassLoader)cl).getURLs();

    for(URL url: urls) {
        System.out.println(url.getFile());
    }
于 2017-10-25T11:43:20.697 回答