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 <[email protected]> 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 <[email protected]>
> 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
>>
>>
>>
>

Reply via email to