[ 
https://issues.apache.org/jira/browse/AVRO-1599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14252052#comment-14252052
 ] 

Doug Cutting commented on AVRO-1599:
------------------------------------

Can you please provide a .proto file that demonstrates this?  We need a 
complete, reproducible unit test in order to fix this.  With a .proto file and 
the above fragment one should be able to create such a test.  Thanks.

> Protobuf object newRecord fails with ClassNotFoundException
> -----------------------------------------------------------
>
>                 Key: AVRO-1599
>                 URL: https://issues.apache.org/jira/browse/AVRO-1599
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.7
>            Reporter: AlexandrosB
>
> When attempting to convert a Protobuf object to Avro I get a runtime error, 
> stating that my Protobuf object class cannot be found.
> {noformat}
> Schema protoSchema = 
> protodata.getSchema(Class.forName("instart.log.AccessLog$AccessLogEntry"));
> Object obj = protodata.newRecord(a, protoSchema); // --> FAILS
> {noformat}
> {noformat}
> exception in thread "main" java.lang.RuntimeException: 
> java.lang.ClassNotFoundException: Failed to load 
> classinstart.log.Accesslog$AccessLogEntry
>       at 
> org.apache.avro.protobuf.ProtobufData.newRecord(ProtobufData.java:145)
>       at com.instart.decoder.All.main(All.java:88)
> Caused by: java.lang.ClassNotFoundException: Failed to load 
> classinstart.log.Accesslog$AccessLogEntry
>       at org.apache.avro.util.ClassUtils.forName(ClassUtils.java:60)
>       at org.apache.avro.util.ClassUtils.forName(ClassUtils.java:36)
>       at 
> org.apache.avro.protobuf.ProtobufData.newRecord(ProtobufData.java:137)
>       ... 1 more
>   {noformat}
> The class is in the classpath, but the outer class name is AccessLog not 
> Accesslog. Following the code it seems that the getNamespace() method in the 
> ProtobufData.java, converts the outer class name to camelCase, and, hence, it 
> cannot be found later.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to