Kranthi Kiran created IGNITE-2829:
-------------------------------------

             Summary: Unable to cache two beans with same class name but 
different package
                 Key: IGNITE-2829
                 URL: https://issues.apache.org/jira/browse/IGNITE-2829
             Project: Ignite
          Issue Type: Bug
          Components: cache
    Affects Versions: 1.5.0.final
         Environment: Tested on Windows and linux OS
            Reporter: Kranthi Kiran
             Fix For: 1.6


Hi,
We are trying to cache two beans with same class name but different package and 
we are getting error something like below. Can you please help in this regards

Exception in thread "main" javax.cache.CacheException: class 
org.apache.ignite.IgniteCheckedException: Duplicate ID [id=-1146372286, 
oldCls=com.yodlee.ignite.test.sub1.TestBean, 
newCls=com.yodlee.ignite.test.sub2.TestBean
        at 
org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1618)
...............
Caused by: class org.apache.ignite.IgniteCheckedException: Duplicate ID 
[id=-1146372286, oldCls=com.yodlee.ignite.test.sub1.TestBean, 
newCls=com.yodlee.ignite.test.sub2.TestBean
        at 
org.apache.ignite.internal.MarshallerContextAdapter.registerClass(MarshallerContextAdapter.java:163)
        at 
org.apache.ignite.internal.binary.BinaryContext.registerUserClassDescriptor(BinaryContext.java:562)
...............
.............

Below is the test program I have written to simulate the problem

Main Program
===========
        public static void main(String[] args)
        {
                IgniteConfiguration config = new IgniteConfiguration();
                config.setClientMode(false);
                config.setPeerClassLoadingEnabled(false);
                
                Ignite ignite = Ignition.start(config);

                System.out.println("Server started...");
                
                CacheConfiguration<String, Object> cacheConfig = new 
CacheConfiguration<String, Object>();
                cacheConfig.setName("test");
                IgniteCache<String, Object> testCache = 
ignite.getOrCreateCache(cacheConfig);

                testCache.put("bean1", new TestBean("bean1"));
                testCache.put("bean2", new 
com.yodlee.ignite.test.sub2.TestBean("bean2"));
                
                System.out.println("Completed");
        }


com.yodlee.ignite.test.sub1.TestBean
============================
package com.yodlee.ignite.test.sub1;

public class TestBean
{
        private String name;
        
        public TestBean()
        {}
        
        public TestBean(String name)
        {
                this.name = name;
        }

        public String getName()
        {
                return name;
        }

        public void setName(String name)
        {
                this.name = name;
        }
}

com.yodlee.ignite.test.sub2.TestBean
=============================

package com.yodlee.ignite.test.sub2;

public class TestBean
{
        private String name;
        
        public TestBean()
        {}

        public TestBean(String name)
        {
                this.name = name;
        }

        public String getName()
        {
                return name;
        }

        public void setName(String name)
        {
                this.name = name;
        }
}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to