avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederic Laruelle <frederic.larue...@gmail.com>
Subject Re: UnresolvedUnionException
Date Tue, 04 Nov 2014 08:06:31 GMT
data looks good,
however we've had a mongo crash the past four days,
just recovered, would be nice if you could run a few tests (with real data)
to make sure everything is back in order,
will post the payment this week, I'll let you know when done

Tks Nick!

Fred

On Mon, Nov 3, 2014 at 1:31 PM, Nick Beenham <nick.beenham@gmail.com> wrote:

> thanks... i used xjc bindings to convert to java.util.Date and String,
> both worked successfully.
>
>
> On Mon Nov 03 2014 at 3:37:39 PM S G <sg.online.email@gmail.com> wrote:
>
>> Hi Nick,
>>
>> This might due to XMLGregorianCalendar not being supported as a
>> data-type in Avro.
>> Could you try using some other data-type (recommend using a String at
>> first, before moving on to a more complex data type)?
>>
>> You might also want to see https://issues.apache.org/jira/browse/AVRO-739
>>
>>
>> -SG
>>
>> On Mon, Nov 3, 2014 at 12:24 PM, Nick Beenham <nick.beenham@gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> I'm trying to resolve another exception... currently my code looks like:
>>>
>>>     @XmlElement(name = "TriggerDate")
>>>     @XmlSchemaType(name = "date")
>>>     protected XMLGregorianCalendar triggerDate;
>>>     @XmlElement(name = "TriggerTime")
>>>     @XmlSchemaType(name = "time")
>>>     protected XMLGregorianCalendar triggerTime;
>>>
>>>
>>> public void sendMessage(Msg msg) throws IOException {
>>>  log.debug("Entering test message send...");
>>> ReflectData reflectData = ReflectData.AllowNull.get();
>>> Schema schema = reflectData.getSchema(Msg.class);
>>>     DatumWriter<Msg> writer = new ReflectDatumWriter<Msg>(schema);
>>>     ByteArrayOutputStream os = new ByteArrayOutputStream();
>>>
>>>     Encoder encoder = EncoderFactory.get().binaryEncoder(os, null);
>>>         writer.write(msg, encoder);
>>>         encoder.flush();
>>>         os.close();
>>>         KeyedMessage<String, byte[]> data = new KeyedMessage<String,
>>> byte[]>(TOPIC_NAME, os.toByteArray());
>>>
>>>         producer.send(data);
>>>  }
>>>
>>> and I'm getting the following exception:
>>>
>>> org.apache.avro.UnresolvedUnionException: Not in union
>>> ["null",{"type":"record","name":"XMLGregorianCalendar","namespace":"javax.xml.datatype","fields":[]}]:
>>> 2014-10-22
>>>
>>> Any ideas?
>>>
>>> Nick
>>>
>>>
>>>
>>

Mime
View raw message