You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Sandor Seres <ss...@code.hu> on 2015/02/09 09:07:23 UTC
ReflectData.get().getSchema(ArrayList.class)
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
Re: ReflectData.get().getSchema(ArrayList.class)
Posted by Clodagh <cl...@gmail.com>.
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