You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Nick Beenham <ni...@gmail.com> on 2014/11/03 21:24:50 UTC

UnresolvedUnionException

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

Re: UnresolvedUnionException

Posted by Frederic Laruelle <fr...@gmail.com>.
Ooops,
sorry about this,
just realized I have been sending emails in error to this alias...

Fred

On Sat, Nov 8, 2014 at 7:40 AM, Frederic Laruelle <
frederic.laruelle@gmail.com> wrote:

> Hi Nick,
>
> I have invoiced my client
> I will pay you last month and this month,
> It will take a few days for the funds to arrive in my account
> it would be great if you could generate an invoice for this, every month.
>
> Tks!
>
> Fred
>
>
> On Tue, Nov 4, 2014 at 12:06 AM, Frederic Laruelle <
> frederic.laruelle@gmail.com> wrote:
>
>> 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 <ni...@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...@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 <ni...@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
>>>>>
>>>>>
>>>>>
>>>>
>>
>

Re: UnresolvedUnionException

Posted by Frederic Laruelle <fr...@gmail.com>.
Hi Nick,

I have invoiced my client
I will pay you last month and this month,
It will take a few days for the funds to arrive in my account
it would be great if you could generate an invoice for this, every month.

Tks!

Fred


On Tue, Nov 4, 2014 at 12:06 AM, Frederic Laruelle <
frederic.laruelle@gmail.com> wrote:

> 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 <ni...@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...@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 <ni...@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
>>>>
>>>>
>>>>
>>>
>

Re: UnresolvedUnionException

Posted by Frederic Laruelle <fr...@gmail.com>.
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 <ni...@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...@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 <ni...@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
>>>
>>>
>>>
>>

Re: UnresolvedUnionException

Posted by Nick Beenham <ni...@gmail.com>.
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...@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 <ni...@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
>>
>>
>>
>

Re: UnresolvedUnionException

Posted by S G <sg...@gmail.com>.
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 <ni...@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
>
>
>