ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Valentin Kulichenko (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (IGNITE-2829) Unable to cache two beans with same class name but different package
Date Tue, 15 Mar 2016 20:59:34 GMT

     [ https://issues.apache.org/jira/browse/IGNITE-2829?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Valentin Kulichenko closed IGNITE-2829.
---------------------------------------

> 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. After little debugging
I found it is because of "org.apache.ignite.internal.binary.BinaryContext" line # 988, where
only simple-class name is considered instead of full-qualified-class name.
> 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)

Mime
View raw message