Generated OuterClass has a lot of incompatibilities !

444 views
Skip to first unread message

Smallufo Huang

unread,
Sep 26, 2016, 1:56:12 PM9/26/16
to Protocol Buffers
Hi , I am new to gRPC / protobuf.

This is my first .proto file :

syntax = "proto3";
option java_package = "destiny.identity.services.grpc";

service EchoService {
rpc echo (EchoRequest) returns (EchoReply) {}
}

message EchoRequest {
string name=1;
}

message EchoReply {
string message = 1;
}

It is simple , but the generated EchoServiceOuterClass.java has a lot of incompatibilities :

~/destiny-identity/target/generated-sources/protobuf/java/destiny/identity/services/grpc/EchoServiceOuterClass.java
Error:(83, 13) java: incompatible types: java.io.IOException cannot be converted to java.lang.String
Error:(152, 18) java: memoizedSize has private access in com.google.protobuf.AbstractMessage
Error:(159, 7) java: memoizedSize has private access in com.google.protobuf.AbstractMessage
Error:(394, 18) java: cannot find symbol
  symbol:   method unwrapIOException()
  location: variable e of type com.google.protobuf.InvalidProtocolBufferException
Error:(586, 13) java: incompatible types: java.io.IOException cannot be converted to java.lang.String
Error:(655, 18) java: memoizedSize has private access in com.google.protobuf.AbstractMessage
Error:(662, 7) java: memoizedSize has private access in com.google.protobuf.AbstractMessage
Error:(897, 18) java: cannot find symbol
  symbol:   method unwrapIOException()
  location: variable e of type com.google.protobuf.InvalidProtocolBufferException

This is my [ partial ] pom.xml

<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<!--
The version of protoc must match protobuf-java. If you don't depend on
protobuf-java directly, you will be transitively depending on the
protobuf-java version that grpc depends on.
-->
<protocArtifact>com.google.protobuf:protoc:3.0.0:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.0.0:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>

The grpc-netty , grpc-protobuf , grpc-stub are all of version of 1.0.0

Where goes wrong here ?
Thanks.

(I don't know whether the problem is related to protobuf or gRPC , so I paste to both forum )


Feng Xiao

unread,
Sep 26, 2016, 2:02:37 PM9/26/16
to Smallufo Huang, Protocol Buffers
This indicates a version mismatch between protocol compiler and protobuf runtime. Are you depending the right protobuf-java 3.0.0 version?
 

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Smallufo Huang

unread,
Sep 26, 2016, 2:13:01 PM9/26/16
to Protocol Buffers, smal...@gmail.com
I am sure I am running version 3.0.0

This is my mvn dependencies :

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Detecting the operating system and CPU architecture
[INFO] ------------------------------------------------------------------------
[INFO] os.detected.name: osx
[INFO] os.detected.arch: x86_64
[INFO] os.detected.classifier: osx-x86_64
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building destiny-identity 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ destiny-identity ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] artifact io.netty:netty-codec-http2: checking for updates from nexus
[INFO] artifact io.netty:netty-codec-http2: checking for updates from spring-snapshots
[INFO] artifact io.netty:netty-codec-http2: checking for updates from spring-milestones
[INFO] artifact io.netty:netty-codec-http2: checking for updates from central
[INFO] artifact io.grpc:grpc-core: checking for updates from nexus
[INFO] artifact io.grpc:grpc-core: checking for updates from spring-snapshots
[INFO] artifact io.grpc:grpc-core: checking for updates from spring-milestones
[INFO] artifact io.grpc:grpc-core: checking for updates from central
[INFO] destiny:destiny-identity:jar:0.0.1
[INFO] +- io.grpc:grpc-netty:jar:1.0.0:compile
[INFO] |  +- io.netty:netty-codec-http2:jar:4.1.3.Final:compile
[INFO] |  |  +- io.netty:netty-codec-http:jar:4.1.3.Final:compile
[INFO] |  |  |  \- io.netty:netty-codec:jar:4.1.3.Final:compile
[INFO] |  |  |     \- (io.netty:netty-transport:jar:4.1.3.Final:compile - omitted for duplicate)
[INFO] |  |  \- io.netty:netty-handler:jar:4.1.3.Final:compile
[INFO] |  |     +- io.netty:netty-buffer:jar:4.1.3.Final:compile
[INFO] |  |     |  \- io.netty:netty-common:jar:4.1.3.Final:compile
[INFO] |  |     +- io.netty:netty-transport:jar:4.1.3.Final:compile
[INFO] |  |     |  +- (io.netty:netty-buffer:jar:4.1.3.Final:compile - omitted for duplicate)
[INFO] |  |     |  \- io.netty:netty-resolver:jar:4.1.3.Final:compile
[INFO] |  |     |     \- (io.netty:netty-common:jar:4.1.3.Final:compile - omitted for duplicate)
[INFO] |  |     \- (io.netty:netty-codec:jar:4.1.3.Final:compile - omitted for duplicate)
[INFO] |  \- io.grpc:grpc-core:jar:1.0.0:compile
[INFO] |     +- (com.google.guava:guava:jar:19.0:compile - omitted for duplicate)
[INFO] |     \- com.google.code.findbugs:jsr305:jar:3.0.0:compile
[INFO] +- io.grpc:grpc-protobuf:jar:1.0.0:compile
[INFO] |  +- com.google.guava:guava:jar:19.0:compile
[INFO] |  +- io.grpc:grpc-protobuf-lite:jar:1.0.0:compile
[INFO] |  |  +- (com.google.guava:guava:jar:19.0:compile - omitted for duplicate)
[INFO] |  |  \- (io.grpc:grpc-core:jar:1.0.0:compile - omitted for duplicate)
[INFO] |  +- com.google.protobuf:protobuf-java:jar:3.0.0:compile
[INFO] |  +- com.google.protobuf:protobuf-java-util:jar:3.0.0:compile
[INFO] |  |  +- (com.google.protobuf:protobuf-java:jar:3.0.0:compile - omitted for duplicate)
[INFO] |  |  +- (com.google.guava:guava:jar:18.0:compile - omitted for conflict with 19.0)
[INFO] |  |  \- com.google.code.gson:gson:jar:2.7:compile (version managed from 2.3)
[INFO] |  \- (io.grpc:grpc-core:jar:1.0.0:compile - omitted for duplicate)
[INFO] +- io.grpc:grpc-stub:jar:1.0.0:compile
[INFO] |  \- (io.grpc:grpc-core:jar:1.0.0:compile - omitted for duplicate)
// skipped


It is com.google.protobuf:protobuf-java:jar:3.0.0:compile , and there are no other protobuf strings in the following skipped dependencies.

Same problem reported to here : https://github.com/grpc/grpc-java/issues/2300

Sorry , not sure where goes wrong , so I post to many places.



Feng Xiao於 2016年9月27日星期二 UTC+8上午2時02分37秒寫道:


To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.

Smallufo Huang

unread,
Sep 26, 2016, 3:47:24 PM9/26/16
to Protocol Buffers, smal...@gmail.com

OK . I found where goes wrong. 
TIL libphonenumber also dependent on protobuf !
And the project is dependent on an older libphonenumber , not via maven , it is via groovy's @Grab !.
That's why mvn's dependency:tree cannot inspect the problem !
And maybe intelliJ regard groovy's @Grab has higher priority.

Anyway , it is fixed. sorry for disturb.




Reply all
Reply to author
Forward
0 new messages