You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "AlexandrosB (JIRA)" <ji...@apache.org> on 2014/11/02 18:22:33 UTC
[jira] [Created] (AVRO-1599) Protobuf object newRecord fails with
ClassNotFoundException
AlexandrosB created AVRO-1599:
---------------------------------
Summary: 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)