You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Clodagh <cl...@gmail.com> on 2015/09/30 16:56:30 UTC

Re: ReflectData.get().getSchema(ArrayList.class)

Sandor Seres <ss...@...> writes:

> 
> 
> Hi,
> I need to serialize a complex object having ArrayList<String> in it. I 
need to put the serialized object into a MQ. I am trying to use Avro for 
object serialization like this. 
> ---------Test---------------------------------
> List list = new ArrayList<String>();
>            Schema schema = 
ReflectData.get().getSchema(list.getClass());
> ------------------------------------------------
> This is what I am getting
> org.apache.avro.AvroRuntimeException: Can't find element type of 
Collection
> at 
org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:435)
> at 
org.apache.avro.specific.SpecificData.getSchema(SpecificData.java:189)
> -----------------------------------------------
> I am completely sure that not I am the first to run into this problem, 
but did not find any answer for such a question till now....
> Any help?
> Thanx
> Sandor 
> 




Hi Sandor, 

Did you ever find a solution for this issue ? I have exactly the same 
problem. 

Or did you cave in the end and use the schema from json instead of from 
refection ?

All I can find is that this error is thrown when this returns true : 
if(Collection.class.isAssignableFrom(TestClass))   

Any /info pointers would be much appreciated.

Cheers

Clodagh