Re: [protobuf] The generated java code crashes if I try to integrate it into an Eclipse Rich Client application

2010-11-16 Thread Kenton Varda
The generated code contains a big string literal which contains metadata
about the types.  The metadata is itself a protocol buffer, and is decoded
at startup.  It looks like it is somehow being corrupted in your
environment.  I don't know how that would happen.  I recently wrote an
Eclipse plugin that used protocol buffers and did not see any problems.

That said, you can try adding this to your .proto file:
  option optimize_for = LITE_RUNTIME;

This turns off a number of features, including self-description.  Thus, the
generated code will no longer contain an embedded descriptor at all.

On Thu, Nov 11, 2010 at 11:00 AM, Alsmom2005  wrote:

> Hi,
>
> I have problems integrating Java GPB generated code into an Eclipse
> Rich Client Platform Application.
>
> The same code works fine in a standalone java project but it crashes
> in the RCP environment at the first 'usage' of an enum value defined
> in GPB code:
>
> Exception in thread "Thread-3" java.lang.ExceptionInInitializerError
>at com.google.protobuf.DescriptorProtos
> $FileDescriptorProto.(DescriptorProtos.java:1687)
>at com.google.protobuf.Descriptors
> $FileDescriptor.internalBuildGeneratedFileFrom(Descriptors.java:338)
>at NGCMOSMsg.NGCMOSMessages.(NGCMOSMessages.java:11255)
>at
> NGCMOSMsg.NGCMOSMessages$MOSEndpoints.(NGCMOSMessages.java:
> 353)
>at communication.PostOffice.(PostOffice.java:31)
>at communication.PostOffice.getPostOffice(PostOffice.java:106)
>at ca.mda.moscs.common.Utilities$1.run(Utilities.java:130)
> Caused by: java.lang.IllegalArgumentException: Failed to parse
> protocol buffer descriptor for generated code.
>at com.google.protobuf.Descriptors
> $FileDescriptor.internalBuildGeneratedFileFrom(Descriptors.java:341)
>at
> com.google.protobuf.DescriptorProtos.(DescriptorProtos.java:
> 12656)
>... 7 more
> Caused by: com.google.protobuf.InvalidProtocolBufferException:
> Protocol message tag had invalid wire type.
>at
>
> com.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java:
> 86)
>at com.google.protobuf.UnknownFieldSet
> $Builder.mergeFieldFrom(UnknownFieldSet.java:600)
>at com.google.protobuf.GeneratedMessage
> $Builder.parseUnknownField(GeneratedMessage.java:320)
>at com.google.protobuf.DescriptorProtos$DescriptorProto
> $Builder.mergeFrom(DescriptorProtos.java:2742)
>at com.google.protobuf.DescriptorProtos$DescriptorProto
> $Builder.mergeFrom(DescriptorProtos.java:1)
>at
> com.google.protobuf.CodedInputStream.readMessage(CodedInputStream.java:
> 285)
>at com.google.protobuf.DescriptorProtos$FileDescriptorProto
> $Builder.mergeFrom(DescriptorProtos.java:1143)
>at com.google.protobuf.DescriptorProtos$FileDescriptorProto
> $Builder.mergeFrom(DescriptorProtos.java:1)
>at com.google.protobuf.AbstractMessage
> $Builder.mergeFrom(AbstractMessage.java:288)
>at com.google.protobuf.AbstractMessage
> $Builder.mergeFrom(AbstractMessage.java:1)
>at com.google.protobuf.AbstractMessageLite
> $Builder.mergeFrom(AbstractMessageLite.java:184)
>at com.google.protobuf.AbstractMessage
> $Builder.mergeFrom(AbstractMessage.java:792)
>at com.google.protobuf.AbstractMessage
> $Builder.mergeFrom(AbstractMessage.java:1)
>at com.google.protobuf.AbstractMessageLite
> $Builder.mergeFrom(AbstractMessageLite.java:174)
>at com.google.protobuf.AbstractMessage
> $Builder.mergeFrom(AbstractMessage.java:785)
>at com.google.protobuf.DescriptorProtos
> $FileDescriptorProto.parseFrom(DescriptorProtos.java:820)
>at com.google.protobuf.Descriptors
> $FileDescriptor.internalBuildGeneratedFileFrom(Descriptors.java:338)
>... 8 more
> java.lang.NullPointerException
>at
>
> com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper
> $ComponentPresentationCache.getCacheFile(ComponentPresentationHelper.java:
> 428)
>at
>
> com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper
> $ComponentPresentationCache.(ComponentPresentationHelper.java:
> 322)
>at
>
> com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper.getCache(ComponentPresentationHelper.java:
> 299)
>at
>
> com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper.access
> $0(ComponentPresentationHelper.java:295)
>at
>
> com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper
> $1.run(ComponentPresentationHelper.java:504)
>at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
> java.lang.NullPointerException
>at
>
> com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper
> $ComponentPresentationCache.getCacheFile(ComponentPresentationHelper.java:
> 428)
>at
>
> com.instantiations.designer.core.xml.model.description.Compon

[protobuf] The generated java code crashes if I try to integrate it into an Eclipse Rich Client application

2010-11-11 Thread Alsmom2005
Hi,

I have problems integrating Java GPB generated code into an Eclipse
Rich Client Platform Application.

The same code works fine in a standalone java project but it crashes
in the RCP environment at the first 'usage' of an enum value defined
in GPB code:

Exception in thread "Thread-3" java.lang.ExceptionInInitializerError
at com.google.protobuf.DescriptorProtos
$FileDescriptorProto.(DescriptorProtos.java:1687)
at com.google.protobuf.Descriptors
$FileDescriptor.internalBuildGeneratedFileFrom(Descriptors.java:338)
at NGCMOSMsg.NGCMOSMessages.(NGCMOSMessages.java:11255)
at NGCMOSMsg.NGCMOSMessages$MOSEndpoints.(NGCMOSMessages.java:
353)
at communication.PostOffice.(PostOffice.java:31)
at communication.PostOffice.getPostOffice(PostOffice.java:106)
at ca.mda.moscs.common.Utilities$1.run(Utilities.java:130)
Caused by: java.lang.IllegalArgumentException: Failed to parse
protocol buffer descriptor for generated code.
at com.google.protobuf.Descriptors
$FileDescriptor.internalBuildGeneratedFileFrom(Descriptors.java:341)
at
com.google.protobuf.DescriptorProtos.(DescriptorProtos.java:
12656)
... 7 more
Caused by: com.google.protobuf.InvalidProtocolBufferException:
Protocol message tag had invalid wire type.
at
com.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java:
86)
at com.google.protobuf.UnknownFieldSet
$Builder.mergeFieldFrom(UnknownFieldSet.java:600)
at com.google.protobuf.GeneratedMessage
$Builder.parseUnknownField(GeneratedMessage.java:320)
at com.google.protobuf.DescriptorProtos$DescriptorProto
$Builder.mergeFrom(DescriptorProtos.java:2742)
at com.google.protobuf.DescriptorProtos$DescriptorProto
$Builder.mergeFrom(DescriptorProtos.java:1)
at
com.google.protobuf.CodedInputStream.readMessage(CodedInputStream.java:
285)
at com.google.protobuf.DescriptorProtos$FileDescriptorProto
$Builder.mergeFrom(DescriptorProtos.java:1143)
at com.google.protobuf.DescriptorProtos$FileDescriptorProto
$Builder.mergeFrom(DescriptorProtos.java:1)
at com.google.protobuf.AbstractMessage
$Builder.mergeFrom(AbstractMessage.java:288)
at com.google.protobuf.AbstractMessage
$Builder.mergeFrom(AbstractMessage.java:1)
at com.google.protobuf.AbstractMessageLite
$Builder.mergeFrom(AbstractMessageLite.java:184)
at com.google.protobuf.AbstractMessage
$Builder.mergeFrom(AbstractMessage.java:792)
at com.google.protobuf.AbstractMessage
$Builder.mergeFrom(AbstractMessage.java:1)
at com.google.protobuf.AbstractMessageLite
$Builder.mergeFrom(AbstractMessageLite.java:174)
at com.google.protobuf.AbstractMessage
$Builder.mergeFrom(AbstractMessage.java:785)
at com.google.protobuf.DescriptorProtos
$FileDescriptorProto.parseFrom(DescriptorProtos.java:820)
at com.google.protobuf.Descriptors
$FileDescriptor.internalBuildGeneratedFileFrom(Descriptors.java:338)
... 8 more
java.lang.NullPointerException
at
com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper
$ComponentPresentationCache.getCacheFile(ComponentPresentationHelper.java:
428)
at
com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper
$ComponentPresentationCache.(ComponentPresentationHelper.java:
322)
at
com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper.getCache(ComponentPresentationHelper.java:
299)
at
com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper.access
$0(ComponentPresentationHelper.java:295)
at
com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper
$1.run(ComponentPresentationHelper.java:504)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
java.lang.NullPointerException
at
com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper
$ComponentPresentationCache.getCacheFile(ComponentPresentationHelper.java:
428)
at
com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper
$ComponentPresentationCache.(ComponentPresentationHelper.java:
322)
at
com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper.getCache(ComponentPresentationHelper.java:
299)
at
com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper.access
$0(ComponentPresentationHelper.java:295)
at
com.instantiations.designer.core.xml.model.description.ComponentPresentationHelper
$1.run(ComponentPresentationHelper.java:504)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


Can anybody give me a hint to address this issue?

Thank you in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegr