a project on line needs to operate HDFS and hive, using the Times below error:
java.lang.unsupportedoperationexception: this is supposed to be overridden by subclasses. at Com.google.protobuf.GeneratedMessage.getUnknownFields (generatedmessage.java:180) at org.apache.hadoop.hdfs.protocol.proto.hdfsprotos$fspermissionproto.getserializedsize (hdfsprotos.java:5407) at Com.google.protobuf.CodedOutputStream.computeMessageSizeNoTag (codedoutputstream.java:749) at com.google.protobuf.codedoutputstream.computemessagesize ( codedoutputstream.java:530) at Org.apache.hadoop.hdfs.protocol.proto.clientnamenodeprotocolprotos$createrequestproto.getserializedsize ( clientnamenodeprotocolprotos.java:2371) at Com.google.protobuf.AbstractMessaGelite.tobytestring (abstractmessagelite.java:49) at Org.apache.hadoop.ipc.protobufrpcengine$invoker.constructrpcrequest (protobufrpcengine.java:149) at org.apache.hadoop.ipc.protobufrpcengine$invoker.invoke ( protobufrpcengine.java:193) at $Proxy 28.create (Unknown source) at Org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.create ( clientnamenodeprotocoltranslatorpb.java:193) at SUN.REFLECT.NATIVEMETHODACCESSORIMPL.INVOKE0 (Native method) at sun.reflect.nativemethodaccessorimpl.invoke (nativemethodaccessorimpl.java:57) at sun.reflect.delegatingmethodaccessorimpl.invoke ( delegatingmethodaccessorimpl.java:43) &Nbsp; at java.lang.reflect.method.invoke (Method.java:601) at Org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod (retryinvocationhandler.java:164) at org.apache.hadoop.io.retry.retryinvocationhandler.invoke ( retryinvocationhandler.java:83) at $Proxy 29.create (Unknown source) at org.apache.hadoop.hdfs.dfsoutputstream. <init> (dfsoutputstream.java:1325) at Org.apache.hadoop.hdfs.DFSOutputStream.newStreamForCreate (dfsoutputstream.java:1344) at org.apache.hadoop.hdfs.dfsclient.create (dfsclient.java:1255) at org.apache.hadoop.hdfs.dfsclient.create (DFSClient.java:1212) &nbsP; at org.apache.hadoop.hdfs.distributedfilesystem.create ( distributedfilesystem.java:276) at Org.apache.hadoop.hdfs.DistributedFileSystem.create (distributedfilesystem.java:265) at org.apache.hadoop.hdfs.distributedfilesystem.create (DistributedFileSystem.java : at org.apache.hadoop.fs.filesystem.create ( filesystem.java:886)
Depending on the stack information, you can see that the problem is PB, and the exception is thrown by the Getunknownfields method of the Com.google.protobuf.GeneratedMessage class.
The definition of this method in 2.4.0a is as follows:
@Override (Java 1.6 Override semantics, but we must-1.5) public final Unknownfieldset Getunknownfields () { return unknownfields; will return a value}
And in the 2.5.0:
@Override (Java 1.6 Override semantics, but we must-1.5) public Unknownfieldset Getunknownfields () {throw n EW unsupportedoperationexception (///In 180 lines can see this method directly returns an error "This is supposed to being overridden by subclasses."); }
This error is caused by the release of PB, the project is running under the Tomcat container, in the web-inf/ Lib directory only found Protobuf-java-2.4.0a.jar package, while in the entire file system also only this one PB package, after the removal of the PB package, the error still exists, that is, it is possible that PB has been hit in another jar package inside. With Jar TVF, the final discovery of PB is in the Hive-exec package:
jar tvf hive-exec-0.13.1.jar |grep protobuf 0 mon jun 02 12:50:20 cst 2014 meta-inf/maven/com.google.protobuf/ 0 mon jun 02 12:50:20 cst 2014 meta-inf/maven/com.google.protobuf/ protobuf-java/ 141 mon jun 02 12:50:20 cst 2014 meta-inf/ Maven/com.google.protobuf/protobuf-java/pom.properties 8375 mon jun 02 12:50:20 CST 2014 META-INF/maven/com.google.protobuf/protobuf-java/pom.xml 0 mon jun 02 12:50:20 cst 2014 com/google/protobuf/ 1014 mon jun 02 12:50:20 cst 2014 com/google/protobuf/abstractmessage$1. Class30034 mon jun 02 12:50:20 cst 2014 com/google/protobuf/abstractmessage $Builder. class 7979 mon jun 02 12:50:20 cst 2014 com/google/protobuf/abstractmessage.class ...
After extracting the jar, look at its pom.properties file and find that PB is 2.5. Version 0
Cd/usr/local/src/meta-inf/maven/com.google.protobuf/protobuf-javacat pom.properties#generated by Org.apache.felix.bundleplugin#thu Mar 15:48:28 PST 2013version=2.5.0groupid=com.google.protobufartifactid= Protobuf-java
Try to change the hive of the Pom file, the PB dependency set to 2.4.0a, compile can not pass, that is, cdh4.6.0 is required to use PB 2.4.x, and hive0.13.1 default is to use 2.5.0, and the project by default loaded 2.5.0 Pb, resulting in an error.
Under
Http://stackoverflow.com/questions/5474765/order-of-loading-jar-files-from-lib-directory
https://issues.apache.org/bugzilla/show_bug.cgi?id=57129
The Tomcat 5-7 jar package is loaded in alphabetical order, So if you want the Protobuf-java-2.4.0a.jar to load before Hive-exec-0.13.1.jar, you can change the Protobuf-java-2.4.0a.jar file name.
This article is from the "Food and Light Blog" blog, please make sure to keep this source http://caiguangguang.blog.51cto.com/1652935/1592804
Protobuf 2.5.0 questions