I am trying to use java.util.Date type field in my Ignite Key and Value
objects. But when I start caching data in same Ignite cache using Java code,
I get following error.

*[12:43:01,485][SEVERE][pool-8-thread-1][] Message is ignored due to an
error [msg=MessageAndMetadata(test1,2,Message(magic = 1, attributes = 0,
CreateTime = -1, crc = 3705259101, key = java.nio.HeapByteBuffer[pos=0 lim=4
cap=3288], payload = java.nio.HeapByteBuffer[pos=0 lim=3280
cap=3280]),302,kafka.serializer.DefaultDecoder@2d50c6a2,kafka.serializer.DefaultDecoder@1ff7596c,-1,CreateTime)]
class org.apache.ignite.binary.BinaryObjectException: Binary type has
different field types [typeName=test.demo.DataKey, fieldName=tstamp,
fieldTypeName1=String, fieldTypeName2=Date]
    at
org.apache.ignite.internal.binary.BinaryUtils.mergeMetadata(BinaryUtils.java:1027)
    at
org.apache.ignite.internal.processors.cache.binary.BinaryMetadataTransport$MetadataUpdateProposedListener.onCustomEvent(BinaryMetadataTransport.java:293)
    at
org.apache.ignite.internal.processors.cache.binary.BinaryMetadataTransport$MetadataUpdateProposedListener.onCustomEvent(BinaryMetadataTransport.java:258)
    at
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$4.onDiscovery0(GridDiscoveryManager.java:707)
    at
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$4.onDiscovery(GridDiscoveryManager.java:589)
    at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.notifyDiscoveryListener(ServerImpl.java:5479)
    at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processCustomMessage(ServerImpl.java:5305)
    at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processMessage(ServerImpl.java:2765)
    at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processMessage(ServerImpl.java:2536)
    at
org.apache.ignite.spi.discovery.tcp.ServerImpl$MessageWorkerAdapter.body(ServerImpl.java:6775)
    at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.body(ServerImpl.java:2621)
    at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)*



Where DataKey is Ignite cache Key which is defined as follows,


*package test.demo;
import java.util.Date;

public class DataKey{

    private Long sess_id ;                                                      
                            
    private Long   s_id;                                                        
            
    private Long   version;                                                     
                
    private Date tstamp;


    public DataKey(Long sess_id, Long s_id, Long version,
            Date tstamp) {
        super();
        this.sess_id = sess_id;
        this.s_id = s_id;
        this.version = version;
        this.tstamp = tstamp;
    }


    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result
                + ((s_id == null) ? 0 : s_id.hashCode());
        result = prime * result
                + ((sess_id == null) ? 0 : sess_id.hashCode());
        result = prime * result
                + ((tstamp == null) ? 0 : tstamp.hashCode());
        result = prime * result + ((version == null) ? 0 :
version.hashCode());
        return result;
    }


    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        DataKey other = (DataKey) obj;
        if (s_id == null) {
            if (other.s_id != null)
                return false;
        } else if (!s_id.equals(other.s_id))
            return false;
        if (sess_id == null) {
            if (other.sess_id != null)
                return false;
        } else if (!sess_id.equals(other.sess_id))
            return false;
        if (tstamp == null) {
            if (other.tstamp != null)
                return false;
        } else if (!tstamp.equals(other.tstamp))
            return false;
        if (version == null) {
            if (other.version != null)
                return false;
        } else if (!version.equals(other.version))
            return false;
        return true;
    }
}*

As mentioned in link 
http://apache-ignite-users.70518.x6.nabble.com/Binary-type-has-different-fields-error-td21540.html
<http://apache-ignite-users.70518.x6.nabble.com/Binary-type-has-different-fields-error-td21540.html>
  
, I even deleted contents from $IGNITE_HOME/work/ directory and restarted
the node. But still error is there. What is causing this error? Also same
error occurs if java.util.Date type field is only used in cache value(not in
key).



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to