Search code examples
gridgain

Gridgain Error Suppressed: class org.gridgain.grid.GridException: Failed to serialize object


I am trying to put a key as String , value as List Intervals> in the cache and I am getting the below error. I have a put method in dao as generalised as object,object> so it can be used for difference cache

Input

[MAC4, [com.xx.Interval@1bccacc7]]
[MAC3, [com.xx.Interval@754b3232]]
[MAC1, [com.xx.Interval@78cf9e78, com.xx.Interval@6ad163f]]  

MAC* is the key and List of Interval Objects are values. Code:

 griddao.put("intervals",tuple.getValue(0),tuple.getValue(1));

In griddao

public void put(String cacheName, Object key, Object value) throws GridException {
                GridCache<Object, Object> cache = caches.get(cacheName);

                if ( cache != null ) {
                  cache.put(key, value);
                }
                else {
                  LOG.error( "Cache is null");
                }

Solution

  • It looks like you forgot to attach the actual error you got. Please provide full exception trace.

    For now you can check whether Interval class implements Serializable. If it doesn't and you can't change it, configure marshaller not to require Serializable interface, like this:

    <bean id="grid.cfg" class="org.gridgain.grid.GridConfiguration">
        ...
    
        <property name="marshaller">
            <bean class="org.gridgain.grid.marshaller.optimized.GridOptimizedMarshaller">
                <property name="requireSerializable" value="false"/>
            </bean>
        </property>
    
        ...
    </bean>