[
https://issues.jboss.org/browse/ISPN-4067?page=com.atlassian.jira.plugin....
]
Stanislav Ivanov updated ISPN-4067:
-----------------------------------
Description:
Infinispan throws NotSerializableException when trying to put inner class to write-behind
cache.
Here is the example:
{code:title=class which I want to store in cache (actually, it's inside the other
class)|borderStyle=solid}
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_;
}
}
{code}
{code:title=cache config|borderStyle=solid}
final EmbeddedCacheManager cacheManager = new DefaultCacheManager();
cacheManager.defineConfiguration(CACHE_NAME,
new ConfigurationBuilder()
.eviction()
.maxEntries(2)
.persistence()
.passivation(false)
.addSingleFileStore()
.location(tmpStoragePath)
.maxEntries(6)
.build());
{code}
{code:title=code that fails|borderStyle=solid}
final Cache<String, PojoCoder> testCache = cacheManager.getCache(CACHE_NAME);
testCache.put("alex", new PojoCoder("django-lover alex",
"Python")); //NotSerializableException on this line
{code}
Actually, stack trace tells something about problem with *this* reference.
Unfortunatelly, I don't have time to investigate deeper this issue - inner class was
created just for test, normally I would store typical outer classes.
was:
Infinispan throws NotSerializableException when trying to put inner class to write-behind
cache.
Here is the example:
{code:title=class which I want to store in cache (actually, it's inside the other
class)|borderStyle=solid}
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_;
}
}
{code}
{code:title=cache config|borderStyle=solid}
final EmbeddedCacheManager cacheManager = new DefaultCacheManager();
cacheManager.defineConfiguration(CACHE_NAME,
new ConfigurationBuilder()
.eviction()
.maxEntries(2)
.persistence()
.passivation(false)
.addSingleFileStore()
.location(tmpStoragePath)
.maxEntries(6)
.build());
{code}
{code:title=code that fails|borderStyle=solid}
final Cache<String, PojoCoder> testCache = cacheManager.getCache(CACHE_NAME);
testCache.put("alex", new PojoCoder("django-lover alex",
"Python")); //NotSerializableException on this line
{code}
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:
{code:title=class which I want to store in cache (actually, it's inside the other
class)|borderStyle=solid}
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_;
}
}
{code}
{code:title=cache config|borderStyle=solid}
final EmbeddedCacheManager cacheManager = new DefaultCacheManager();
cacheManager.defineConfiguration(CACHE_NAME,
new ConfigurationBuilder()
.eviction()
.maxEntries(2)
.persistence()
.passivation(false)
.addSingleFileStore()
.location(tmpStoragePath)
.maxEntries(6)
.build());
{code}
{code:title=code that fails|borderStyle=solid}
final Cache<String, PojoCoder> testCache = cacheManager.getCache(CACHE_NAME);
testCache.put("alex", new PojoCoder("django-lover alex",
"Python")); //NotSerializableException on this line
{code}
Actually, stack trace tells something about problem with *this* reference.
Unfortunatelly, I don't have time to investigate deeper this issue - inner class was
created just for test, normally I would store typical outer classes.
--
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