You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Isaeed Mohanna <is...@gmail.com> on 2015/06/01 09:41:38 UTC

Failed to marshal object When inserting to queue

Hi
I have a very simply queue, that is backed by a simple cache object.
I have the following class:
public class MyClass implements Serializable {
    private static final long serialVersionUID...
    private String id;
    private Date time;

    // Setters & Getters
}

When trying to insert a list of MyClass elements into the queue, i get a
failed to marshal exception even though my class is Serializable. (Full
exception is attached)
exception.txt
<http://apache-ignite-users.70518.x6.nabble.com/file/n432/exception.txt>  

Why am i receiving this exception even though my class is Serializable, is
there any way around it without disabling the marshaller which could cause
performance degradation as i understood?
*My Cache configuration:*
CacheConfiguration<?, ?> cache= new CacheConfiguration<>();
cache.setName("queueCache");
cache.setCacheMode(CacheMode.REPLICATED);
cache.setAtomicityMode(CacheAtomicityMode.ATOMIC);
*My Queue Init:*
CollectionConfiguration colCfg = new CollectionConfiguration();
colCfg.setCacheName("queueCache");
IgniteQueue<MyClass> queue = ignite.queue("queueCache", 0, colCfg);

* Queue Usage*
List<Myclass> queueItems;
// Populate list with some data
queue.addAll(queueItems);

Thanks for your help



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Failed-to-marshal-object-When-inserting-to-queue-tp432.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Failed to marshal object When inserting to queue

Posted by yakov <yz...@apache.org>.
Externalizable is faster, but less flexible. Externalizable does not allow
class mutation, while Serializable does.

I would recommend to go with Externalizable and handle class mutation
manually.




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Failed-to-marshal-object-When-inserting-to-queue-tp432p435.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Failed to marshal object When inserting to queue

Posted by Isaeed Mohanna <is...@gmail.com>.
Hi
I have created a standalone application to reproduce the problem but then i
got it to work, i implemented Externalizable interface... it turns out that
some older version of the class was used in my setup for some reason.
Deeply sorry for wasting your time... a question thought... what is the
difference between implementing serializable vs externalizable to be used
with ignite? is there any major difference? should i prefer one over the
other?

Thanks

On Mon, Jun 1, 2015 at 12:28 PM, Semyon Boikov <sb...@gridgain.com> wrote:

> Hi,
>
> I can not reproduce this error, could you please provide all your code so
> that I can run it.
> Also looks like exception you attached is not completed: exception cause
> if missed.
>
> On Mon, Jun 1, 2015 at 10:41 AM, Isaeed Mohanna <is...@gmail.com> wrote:
>
>> Hi
>> I have a very simply queue, that is backed by a simple cache object.
>> I have the following class:
>> public class MyClass implements Serializable {
>>     private static final long serialVersionUID...
>>     private String id;
>>     private Date time;
>>
>>     // Setters & Getters
>> }
>>
>> When trying to insert a list of MyClass elements into the queue, i get a
>> failed to marshal exception even though my class is Serializable. (Full
>> exception is attached)
>> exception.txt
>> <http://apache-ignite-users.70518.x6.nabble.com/file/n432/exception.txt>
>>
>> Why am i receiving this exception even though my class is Serializable, is
>> there any way around it without disabling the marshaller which could cause
>> performance degradation as i understood?
>> *My Cache configuration:*
>> CacheConfiguration<?, ?> cache= new CacheConfiguration<>();
>> cache.setName("queueCache");
>> cache.setCacheMode(CacheMode.REPLICATED);
>> cache.setAtomicityMode(CacheAtomicityMode.ATOMIC);
>> *My Queue Init:*
>> CollectionConfiguration colCfg = new CollectionConfiguration();
>> colCfg.setCacheName("queueCache");
>> IgniteQueue<MyClass> queue = ignite.queue("queueCache", 0, colCfg);
>>
>> * Queue Usage*
>> List<Myclass> queueItems;
>> // Populate list with some data
>> queue.addAll(queueItems);
>>
>> Thanks for your help
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-ignite-users.70518.x6.nabble.com/Failed-to-marshal-object-When-inserting-to-queue-tp432.html
>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>>
>
>

Re: Failed to marshal object When inserting to queue

Posted by Semyon Boikov <sb...@gridgain.com>.
Hi,

I can not reproduce this error, could you please provide all your code so
that I can run it.
Also looks like exception you attached is not completed: exception cause if
missed.

On Mon, Jun 1, 2015 at 10:41 AM, Isaeed Mohanna <is...@gmail.com> wrote:

> Hi
> I have a very simply queue, that is backed by a simple cache object.
> I have the following class:
> public class MyClass implements Serializable {
>     private static final long serialVersionUID...
>     private String id;
>     private Date time;
>
>     // Setters & Getters
> }
>
> When trying to insert a list of MyClass elements into the queue, i get a
> failed to marshal exception even though my class is Serializable. (Full
> exception is attached)
> exception.txt
> <http://apache-ignite-users.70518.x6.nabble.com/file/n432/exception.txt>
>
> Why am i receiving this exception even though my class is Serializable, is
> there any way around it without disabling the marshaller which could cause
> performance degradation as i understood?
> *My Cache configuration:*
> CacheConfiguration<?, ?> cache= new CacheConfiguration<>();
> cache.setName("queueCache");
> cache.setCacheMode(CacheMode.REPLICATED);
> cache.setAtomicityMode(CacheAtomicityMode.ATOMIC);
> *My Queue Init:*
> CollectionConfiguration colCfg = new CollectionConfiguration();
> colCfg.setCacheName("queueCache");
> IgniteQueue<MyClass> queue = ignite.queue("queueCache", 0, colCfg);
>
> * Queue Usage*
> List<Myclass> queueItems;
> // Populate list with some data
> queue.addAll(queueItems);
>
> Thanks for your help
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Failed-to-marshal-object-When-inserting-to-queue-tp432.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>