Getting IllegalAccessError in getSerializedSize()

3,545 views
Skip to first unread message

Balaji R

unread,
Nov 16, 2015, 1:32:17 PM11/16/15
to Protocol Buffers
With protobuf-java:3.0.0-beta-1 and protoc:3.0.0-beta-1, I have started getting IllegalAccessError in the generated code for access to memoizedSize in getSerializedSize():


java.lang.IllegalAccessError: tried to access field com.google.protobuf.AbstractMessage.memoizedSize from class com.playground.proto.PlayProtos$DummyMessage
at com.playground.proto.PlayProtos$DummyMessage.getSerializedSize(PlayProtos.java:722)
at com.google.protobuf.AbstractMessageLite.toByteArray(AbstractMessageLite.java:64)

I am using syntax = "proto2".

syntax = "proto2";
 
package playground;
option java_package = "com.playground.proto";
option java_outer_classname = "PlayProtos";
 
message DummyMessage {
... 
} 

Paweł Szczur

unread,
Sep 2, 2016, 3:07:15 PM9/2/16
to Protocol Buffers
Funny, just installed protobuf-java:3.0.0 and getting this error with proto2.

I've generated the code using protoc version 3.0.0.

Nibin Varghese

unread,
Oct 18, 2016, 2:07:10 PM10/18/16
to Protocol Buffers
Hi,

I started to get this error with protoc-3.0.0/3.0.2. How can this be resolved ? 


Regards,
Nibin

Marc-Antoine Bibeau

unread,
Jan 30, 2017, 10:13:36 AM1/30/17
to Protocol Buffers
Any news on this? I'm getting the same issue with version 3.2.0 :(

Adam Cozzette

unread,
Jan 30, 2017, 12:08:25 PM1/30/17
to Marc-Antoine Bibeau, Protocol Buffers
Is it possible that you are somehow mixing protobuf versions? I would guess that your application has dependencies which are pulling in two different versions of the protobuf runtime.

--
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.

Marc-Antoine Bibeau

unread,
Jan 30, 2017, 12:44:17 PM1/30/17
to Adam Cozzette, Protocol Buffers
Yes, found my problem. Was using an old version of com.googlecode.libphonenumber that was packaging old protobuf version in :(

Thanks a lot for your answer!


Marc-Antoine Bibeau
Staff Software Engineer
AppDirect
1-514-913-4194
Blog | Press | Video Center
This communication and any attachments may contain Confidential Information of AppDirect, Inc. All unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify AppDirect, Inc. immediately and destroy all copies of this communication. Thank you.

On Mon, Jan 30, 2017 at 12:08 PM, Adam Cozzette <acoz...@google.com> wrote:
Is it possible that you are somehow mixing protobuf versions? I would guess that your application has dependencies which are pulling in two different versions of the protobuf runtime.

samir...@diversey.com

unread,
May 1, 2019, 2:07:54 PM5/1/19
to Protocol Buffers

Hi Marc - I am facing this issue and was wondering which version of com.googlecode.libphonenumber did you use to resolve this.


On Monday, January 30, 2017 at 12:44:17 PM UTC-5, Marc-Antoine Bibeau wrote:
Yes, found my problem. Was using an old version of com.googlecode.libphonenumber that was packaging old protobuf version in :(

Thanks a lot for your answer!


Marc-Antoine Bibeau
Staff Software Engineer
AppDirect
1-514-913-4194
Blog | Press | Video Center
This communication and any attachments may contain Confidential Information of AppDirect, Inc. All unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify AppDirect, Inc. immediately and destroy all copies of this communication. Thank you.

On Mon, Jan 30, 2017 at 12:08 PM, Adam Cozzette <acoz...@google.com> wrote:
Is it possible that you are somehow mixing protobuf versions? I would guess that your application has dependencies which are pulling in two different versions of the protobuf runtime.
On Mon, Jan 30, 2017 at 7:13 AM, Marc-Antoine Bibeau <marc-anto...@appdirect.com> wrote:
Any news on this? I'm getting the same issue with version 3.2.0 :(


On Tuesday, October 18, 2016 at 2:07:10 PM UTC-4, Nibin Geevarghese wrote:
Hi,

I started to get this error with protoc-3.0.0/3.0.2. How can this be resolved ? 


Regards,
Nibin

On Friday, 2 September 2016 12:07:15 UTC-7, Paweł Szczur wrote:
Funny, just installed protobuf-java:3.0.0 and getting this error with proto2.

I've generated the code using protoc version 3.0.0.

On Monday, November 16, 2015 at 7:32:17 PM UTC+1, Balaji R wrote:
With protobuf-java:3.0.0-beta-1 and protoc:3.0.0-beta-1, I have started getting IllegalAccessError in the generated code for access to memoizedSize in getSerializedSize():


java.lang.IllegalAccessError: tried to access field com.google.protobuf.AbstractMessage.memoizedSize from class com.playground.proto.PlayProtos$DummyMessage
at com.playground.proto.PlayProtos$DummyMessage.getSerializedSize(PlayProtos.java:722)
at com.google.protobuf.AbstractMessageLite.toByteArray(AbstractMessageLite.java:64)

I am using syntax = "proto2".

syntax = "proto2";
 
package playground;
option java_package = "com.playground.proto";
option java_outer_classname = "PlayProtos";
 
message DummyMessage {
... 
} 

--
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 prot...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages