[infinispan-issues] [JBoss JIRA] (ISPN-4067) Infinispan cannot put inner classes to write-behind cache
Stanislav Ivanov (JIRA)
issues at jboss.org
Mon Mar 3 02:52:47 EST 2014
[ https://issues.jboss.org/browse/ISPN-4067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stanislav Ivanov updated ISPN-4067:
-----------------------------------
Description:
Infinispan throws NotSerializableException when trying to put inner class to write-behind cache.
Here is the example:
class
final class PojoCoder implements Serializable {
private static final long serialVersionUID = -6238699065180988597L;
private String name_;
private String favouriteLanguage_;
PojoCoder(String name, String favouriteLanguage) {
name_ = name;
favouriteLanguage_ = favouriteLanguage;
}
@Override
public String toString() {
return name_ + " loves " + favouriteLanguage_;
}
public String getFavouriteLanguage() {
return favouriteLanguage_;
}
public String getName() {
return name_;
}
}
cache config:
final EmbeddedCacheManager cacheManager = new DefaultCacheManager();
cacheManager.defineConfiguration(CACHE_NAME,
new ConfigurationBuilder()
.eviction()
.maxEntries(2)
.persistence()
.passivation(false)
.addSingleFileStore()
.location(tmpStoragePath)
.maxEntries(6)
.build());
code that fails:
{{final Cache<String, PojoCoder> testCache = cacheManager.getCache(CACHE_NAME);}}
{{testCache.put("alex", new PojoCoder("django-lover alex", "Python"));}} //NotSerializableException on this line
was:
Infinispan throws NotSerializableException when trying to put inner class to write-behind cache.
Here is the example:
class
final class PojoCoder implements Serializable {
private static final long serialVersionUID = -6238699065180988597L;
private String name_;
private String favouriteLanguage_;
PojoCoder(String name, String favouriteLanguage) {
name_ = name;
favouriteLanguage_ = favouriteLanguage;
}
@Override
public String toString() {
return name_ + " loves " + favouriteLanguage_;
}
public String getFavouriteLanguage() {
return favouriteLanguage_;
}
public String getName() {
return name_;
}
}
cache config:
final EmbeddedCacheManager cacheManager = new DefaultCacheManager();
cacheManager.defineConfiguration(CACHE_NAME,
new ConfigurationBuilder()
.eviction()
.maxEntries(2)
.persistence()
.passivation(false)
.addSingleFileStore()
.location(tmpStoragePath)
.maxEntries(6)
.build());
code that fails:
testCache.put("alex", new PojoCoder("django-lover alex", "Python"));
> Infinispan cannot put inner classes to write-behind cache
> ---------------------------------------------------------
>
> Key: ISPN-4067
> URL: https://issues.jboss.org/browse/ISPN-4067
> Project: Infinispan
> Issue Type: Bug
> Components: Marshalling
> Affects Versions: 6.0.0.Final
> Environment: JDK 1.7_45
> Reporter: Stanislav Ivanov
> Assignee: Dan Berindei
> Priority: Minor
>
> Infinispan throws NotSerializableException when trying to put inner class to write-behind cache.
> Here is the example:
> class
> final class PojoCoder implements Serializable {
> private static final long serialVersionUID = -6238699065180988597L;
> private String name_;
> private String favouriteLanguage_;
> PojoCoder(String name, String favouriteLanguage) {
> name_ = name;
> favouriteLanguage_ = favouriteLanguage;
> }
> @Override
> public String toString() {
> return name_ + " loves " + favouriteLanguage_;
> }
> public String getFavouriteLanguage() {
> return favouriteLanguage_;
> }
> public String getName() {
> return name_;
> }
> }
> cache config:
> final EmbeddedCacheManager cacheManager = new DefaultCacheManager();
> cacheManager.defineConfiguration(CACHE_NAME,
> new ConfigurationBuilder()
> .eviction()
> .maxEntries(2)
> .persistence()
> .passivation(false)
> .addSingleFileStore()
> .location(tmpStoragePath)
> .maxEntries(6)
> .build());
> code that fails:
> {{final Cache<String, PojoCoder> testCache = cacheManager.getCache(CACHE_NAME);}}
> {{testCache.put("alex", new PojoCoder("django-lover alex", "Python"));}} //NotSerializableException on this line
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the infinispan-issues
mailing list