Hi guys, I am experimenting with avro and trying to generate a protocol from
an existing class. As as test, I created this class:
public class Hello {
public void hello(String name)
{
System.out.println("Hello " +name);
}
}
I am using the following method to create the procotol:
ReflectData.getProtocol(Hello.class);
And here is the exception I am getting:
Exception in thread "main" java.lang.NullPointerException
at
org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:153)
at
org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:183)
at org.apache.avro.reflect.ReflectData.getMessage(ReflectData.java:228)
at org.apache.avro.reflect.ReflectData.getProtocol(ReflectData.java:204)
at
com.ask.tiburon.frill.test.AvroProtocolGenerator.main(AvroProtocolGenerator.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
I am using the avro 1.0 jars/source.
Any ideas to what I am doing wrong would be appreciated. I do have
PARANAMER being run and the following code does show the parameter names:
try
{
Method[] methods = Hello.class.getMethods();
Paranamer paranamer = new CachingParanamer();
for(Method method: methods)
{
String[] parameterNames =
paranamer.lookupParameterNames(method);
System.out.println(method.getName() + " : ");
for(String name : parameterNames)
{
System.out.println("\t" + name);
}
}
} catch (Exception e)
{
System.out.println("Exception: " + e.getMessage());
}
Thanks,
Hiral