simple-spring-memcached upgrade to 4.1.1 causing WrappedCacheException
I recently upgraded simple-spring-memcached from version 3.6.1 to 4.1.1. However, after this version upgrade, I am getting WrappedCacheException whenever my code is trying to fetch a value from the cache. I am sharing my code snippet below:
@Transactional
@Cacheable(value = CACHE_NAME, key = "#id")
@Override
public TicketModel validate(final String id) {
TicketEntity ticketEntity = ticketEntityRepository.findOne(id);
if (ticketEntity == null) {
System.out.println("Ticket not found")
}
return something;
}
And my cacheManager bean looks like:
@Bean
public CacheManager cacheManager() throws Exception {
List<SSMCache> cacheList = new ArrayList<>();
CacheFactory cacheFactory;
if (ELASTIC_CACHE_FACTORY.equals(cacheBean)) {
cacheFactory = elastiCacheFactory();
} else {
cacheFactory = memCacheFactory();
}
Cache cache = cacheFactory.getObject();
SSMCache aamCache = new SSMCache(cache, cacheTimeout, true);
cacheList.add(aamCache);
SSMCacheManager cacheManager = new SSMCacheManager();
cacheManager.setCaches(cacheList);
cacheManager.afterPropertiesSet();
return cacheManager;
}
The exact exception that I am getting looks like this:
SEVERE: Servlet.service() for servlet [jersey-servlet] in context with path [/user-service-web] threw exception [com.google.code.ssm.spring.WrappedCacheException] with root cause
com.google.code.ssm.spring.WrappedCacheException
at com.google.code.ssm.spring.SSMCache.logOrThrow(SSMCache.java:318)
at com.google.code.ssm.spring.SSMCache.getValue(SSMCache.java:285)
at com.google.code.ssm.spring.SSMCache.get(SSMCache.java:117)
at org.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:68)
at org.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:469)
at org.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:435)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:336)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:302)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
Whenever there is a call to findOne(id) method, I get WrappedCacheException and the code fails. Please help.
java spring caching memcached
add a comment |
I recently upgraded simple-spring-memcached from version 3.6.1 to 4.1.1. However, after this version upgrade, I am getting WrappedCacheException whenever my code is trying to fetch a value from the cache. I am sharing my code snippet below:
@Transactional
@Cacheable(value = CACHE_NAME, key = "#id")
@Override
public TicketModel validate(final String id) {
TicketEntity ticketEntity = ticketEntityRepository.findOne(id);
if (ticketEntity == null) {
System.out.println("Ticket not found")
}
return something;
}
And my cacheManager bean looks like:
@Bean
public CacheManager cacheManager() throws Exception {
List<SSMCache> cacheList = new ArrayList<>();
CacheFactory cacheFactory;
if (ELASTIC_CACHE_FACTORY.equals(cacheBean)) {
cacheFactory = elastiCacheFactory();
} else {
cacheFactory = memCacheFactory();
}
Cache cache = cacheFactory.getObject();
SSMCache aamCache = new SSMCache(cache, cacheTimeout, true);
cacheList.add(aamCache);
SSMCacheManager cacheManager = new SSMCacheManager();
cacheManager.setCaches(cacheList);
cacheManager.afterPropertiesSet();
return cacheManager;
}
The exact exception that I am getting looks like this:
SEVERE: Servlet.service() for servlet [jersey-servlet] in context with path [/user-service-web] threw exception [com.google.code.ssm.spring.WrappedCacheException] with root cause
com.google.code.ssm.spring.WrappedCacheException
at com.google.code.ssm.spring.SSMCache.logOrThrow(SSMCache.java:318)
at com.google.code.ssm.spring.SSMCache.getValue(SSMCache.java:285)
at com.google.code.ssm.spring.SSMCache.get(SSMCache.java:117)
at org.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:68)
at org.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:469)
at org.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:435)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:336)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:302)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
Whenever there is a call to findOne(id) method, I get WrappedCacheException and the code fails. Please help.
java spring caching memcached
add a comment |
I recently upgraded simple-spring-memcached from version 3.6.1 to 4.1.1. However, after this version upgrade, I am getting WrappedCacheException whenever my code is trying to fetch a value from the cache. I am sharing my code snippet below:
@Transactional
@Cacheable(value = CACHE_NAME, key = "#id")
@Override
public TicketModel validate(final String id) {
TicketEntity ticketEntity = ticketEntityRepository.findOne(id);
if (ticketEntity == null) {
System.out.println("Ticket not found")
}
return something;
}
And my cacheManager bean looks like:
@Bean
public CacheManager cacheManager() throws Exception {
List<SSMCache> cacheList = new ArrayList<>();
CacheFactory cacheFactory;
if (ELASTIC_CACHE_FACTORY.equals(cacheBean)) {
cacheFactory = elastiCacheFactory();
} else {
cacheFactory = memCacheFactory();
}
Cache cache = cacheFactory.getObject();
SSMCache aamCache = new SSMCache(cache, cacheTimeout, true);
cacheList.add(aamCache);
SSMCacheManager cacheManager = new SSMCacheManager();
cacheManager.setCaches(cacheList);
cacheManager.afterPropertiesSet();
return cacheManager;
}
The exact exception that I am getting looks like this:
SEVERE: Servlet.service() for servlet [jersey-servlet] in context with path [/user-service-web] threw exception [com.google.code.ssm.spring.WrappedCacheException] with root cause
com.google.code.ssm.spring.WrappedCacheException
at com.google.code.ssm.spring.SSMCache.logOrThrow(SSMCache.java:318)
at com.google.code.ssm.spring.SSMCache.getValue(SSMCache.java:285)
at com.google.code.ssm.spring.SSMCache.get(SSMCache.java:117)
at org.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:68)
at org.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:469)
at org.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:435)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:336)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:302)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
Whenever there is a call to findOne(id) method, I get WrappedCacheException and the code fails. Please help.
java spring caching memcached
I recently upgraded simple-spring-memcached from version 3.6.1 to 4.1.1. However, after this version upgrade, I am getting WrappedCacheException whenever my code is trying to fetch a value from the cache. I am sharing my code snippet below:
@Transactional
@Cacheable(value = CACHE_NAME, key = "#id")
@Override
public TicketModel validate(final String id) {
TicketEntity ticketEntity = ticketEntityRepository.findOne(id);
if (ticketEntity == null) {
System.out.println("Ticket not found")
}
return something;
}
And my cacheManager bean looks like:
@Bean
public CacheManager cacheManager() throws Exception {
List<SSMCache> cacheList = new ArrayList<>();
CacheFactory cacheFactory;
if (ELASTIC_CACHE_FACTORY.equals(cacheBean)) {
cacheFactory = elastiCacheFactory();
} else {
cacheFactory = memCacheFactory();
}
Cache cache = cacheFactory.getObject();
SSMCache aamCache = new SSMCache(cache, cacheTimeout, true);
cacheList.add(aamCache);
SSMCacheManager cacheManager = new SSMCacheManager();
cacheManager.setCaches(cacheList);
cacheManager.afterPropertiesSet();
return cacheManager;
}
The exact exception that I am getting looks like this:
SEVERE: Servlet.service() for servlet [jersey-servlet] in context with path [/user-service-web] threw exception [com.google.code.ssm.spring.WrappedCacheException] with root cause
com.google.code.ssm.spring.WrappedCacheException
at com.google.code.ssm.spring.SSMCache.logOrThrow(SSMCache.java:318)
at com.google.code.ssm.spring.SSMCache.getValue(SSMCache.java:285)
at com.google.code.ssm.spring.SSMCache.get(SSMCache.java:117)
at org.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:68)
at org.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:469)
at org.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:435)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:336)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:302)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
Whenever there is a call to findOne(id) method, I get WrappedCacheException and the code fails. Please help.
java spring caching memcached
java spring caching memcached
edited Nov 21 '18 at 7:07
Akhil Prajapati
asked Nov 21 '18 at 7:02
Akhil PrajapatiAkhil Prajapati
134113
134113
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53406810%2fsimple-spring-memcached-upgrade-to-4-1-1-causing-wrappedcacheexception%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53406810%2fsimple-spring-memcached-upgrade-to-4-1-1-causing-wrappedcacheexception%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown