掲示板
MultiVMPool cache in Liferay 6.2
10年前 に Giang Nguyen によって更新されました。
MultiVMPool cache in Liferay 6.2
New Member 投稿: 4 参加年月日: 13/09/16 最新の投稿
Hi all,
In LR 6.0, I set the cache by MultiVMPoolUtil by this:
But in LR 6.2, when I deploy sample portlet with MultiVMPoolUtil.put() method, server throws these exception:
when I looking in the source code of LR, I can not find put method. So how can I set cache by MultiVMPool in LR 6.2?
Thank you.
In LR 6.0, I set the cache by MultiVMPoolUtil by this:
MultiVMPoolUtil.put("Cache-name", "key" ,"value");
But in LR 6.2, when I deploy sample portlet with MultiVMPoolUtil.put() method, server throws these exception:
Caused by: java.lang.NoSuchMethodError: com.liferay.portal.kernel.cache.MultiVMPoolUtil.put(Ljava/lang/String;Ljava/lang/String;Ljava/io/Ser
ializable;)V
when I looking in the source code of LR, I can not find put method. So how can I set cache by MultiVMPool in LR 6.2?
Thank you.
10年前 に Juan Gonzalez によって更新されました。
RE: MultiVMPool cache in Liferay 6.2
Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
i Giang,
guess what you need is:
guess what you need is:
MultiVMPoolUtil.getCache("yourCacheName").put(key, value)
10年前 に Giang Nguyen によって更新されました。
RE: MultiVMPool cache in Liferay 6.2
New Member 投稿: 4 参加年月日: 13/09/16 最新の投稿
Hi Juan,
Thanks for your support. After I used your recommend code, I got new no method exception with method put() in PortalCache package.
I found put() in source code of LR 6.2, but I dont know why it throw exception.
Do you have any solution for this?
Thanks for your support. After I used your recommend code, I got new no method exception with method put() in PortalCache package.
Caused by: java.lang.NoSuchMethodError: com.liferay.portal.kernel.cache.PortalCache.put(Ljava/io/Serializable;Ljava/io/Serializable;)V
I found put() in source code of LR 6.2, but I dont know why it throw exception.
Do you have any solution for this?
10年前 に Antoine Comble によって更新されました。
RE: MultiVMPool cache in Liferay 6.2
Regular Member 投稿: 232 参加年月日: 12/09/07 最新の投稿
Hi,
You should read the api : http://grepcode.com/file/repo1.maven.org/maven2/com.liferay.portal/portal-service/6.2.0/com/liferay/portal/kernel/cache/BlockingPortalCache.java?av=f
At line 111, the code is _portalCache.put(key, value).
On mouseover, you could read the value parameter expected must be java.lang.Object.
Hope this help you,
Regards,
Antoine
You should read the api : http://grepcode.com/file/repo1.maven.org/maven2/com.liferay.portal/portal-service/6.2.0/com/liferay/portal/kernel/cache/BlockingPortalCache.java?av=f
At line 111, the code is _portalCache.put(key, value).
On mouseover, you could read the value parameter expected must be java.lang.Object.
Hope this help you,
Regards,
Antoine
10年前 に Giang Nguyen によって更新されました。
RE: MultiVMPool cache in Liferay 6.2
New Member 投稿: 4 参加年月日: 13/09/16 最新の投稿
Hi Antoine,
I read the api already and I thought we can put a pair <key,value> with any value. Because java.lang.Object is the root of any type in java, included String, right?
One more thing the put() method we are talking is come from PortalCache.java, not BlockingPortalCache.java. So i dont think this is problem.
I read the api already and I thought we can put a pair <key,value> with any value. Because java.lang.Object is the root of any type in java, included String, right?
http://docs.oracle.com/javase/7/docs/api/java/lang/String.html
One more thing the put() method we are talking is come from PortalCache.java, not BlockingPortalCache.java. So i dont think this is problem.
10年前 に Antoine Comble によって更新されました。
RE: MultiVMPool cache in Liferay 6.2
Regular Member 投稿: 232 参加年月日: 12/09/07 最新の投稿
PortalCache is an interface and BlockingPortalCache implements it.
It was for an example of use of PortalCache.put method.
You're right. If String cannot put as value, this is not the problem.
Antoine
It was for an example of use of PortalCache.put method.
You're right. If String cannot put as value, this is not the problem.
Antoine
8年前 に Tushar Patel によって更新されました。
RE: MultiVMPool cache in Liferay 6.2
New Member 投稿: 12 参加年月日: 14/08/26 最新の投稿Antoine Comble:
PortalCache is an interface and BlockingPortalCache implements it.
It was for an example of use of PortalCache.put method.
You're right. If String cannot put as value, this is not the problem.
Antoine
Hi Antoine
Can you put little snippet for put the catche? Earlier we are using MultiVMPoolUtil.put() method. Thanks
7年前 に archana thakur によって更新されました。
RE: MultiVMPool cache in Liferay 6.2
Junior Member 投稿: 27 参加年月日: 12/03/13 最新の投稿
Hi Gonzalez ,
I am upgrading liferay 6.1 to 6.2
instead of this
MultiVMPoolUtil.put(cacheName, key, cacheObj);
I am using this method
String kv = (String)MultiVMPoolUtil.getCache(cacheName);
MultiVMPoolUtil.getCache("CacheName").put(key, kv);
its giving me compilation error
incompatible types: PortalCache<Serializable,Serializable> cannot be converted to String
can you please help me or anyone is resolve this issue.
Thanks
Archana
I am upgrading liferay 6.1 to 6.2
instead of this
MultiVMPoolUtil.put(cacheName, key, cacheObj);
I am using this method
String kv = (String)MultiVMPoolUtil.getCache(cacheName);
MultiVMPoolUtil.getCache("CacheName").put(key, kv);
its giving me compilation error
incompatible types: PortalCache<Serializable,Serializable> cannot be converted to String
can you please help me or anyone is resolve this issue.
Thanks
Archana
7年前 に Juan Gonzalez によって更新されました。
RE: MultiVMPool cache in Liferay 6.2
Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿archana thakur:
its giving me compilation error
incompatible types: PortalCache<Serializable,Serializable> cannot be converted to String
can you please help me or anyone is resolve this issue.
Thanks
Archana
getCache doesn't return a String object, but a PortalCache object. You sould change that.
7年前 に archana thakur によって更新されました。
RE: MultiVMPool cache in Liferay 6.2
Junior Member 投稿: 27 参加年月日: 12/03/13 最新の投稿
Hi Gonzalez
now I make change this
PortalCache cache = MultiVMPoolUtil.getCache("cacheName");
its giving me error message
CacheUtil.java:[113,2] error: cannot find symbol
Thanks
Archana
now I make change this
PortalCache cache = MultiVMPoolUtil.getCache("cacheName");
its giving me error message
CacheUtil.java:[113,2] error: cannot find symbol
Thanks
Archana
7年前 に Juan Gonzalez によって更新されました。
RE: MultiVMPool cache in Liferay 6.2
Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿archana thakur:
Hi Gonzalez
now I make change this
PortalCache cache = MultiVMPoolUtil.getCache("cacheName");
its giving me error message
CacheUtil.java:[113,2] error: cannot find symbol
Thanks
Archana
Sorry I think there are missing info there, paste complete error.
You probably forgot to import some packages for that code.
7年前 に archana thakur によって更新されました。
RE: MultiVMPool cache in Liferay 6.2
Junior Member 投稿: 27 参加年月日: 12/03/13 最新の投稿
Hi Juan,
After make this API changes we are facing one other issue in Liferay 6.2.1 EE .
ehcache class is not loading , we have try to loading this class with different version but no success .
net.sf.ehcache.CacheException:
Unable to load class net.sf.ehcache.store.DefaultElementValueComparator.
Initial cause was net.sf.ehcache.store.DefaultElementValueComparator.<
init>(net.sf.ehcache.config.CacheConfiguration)
at net.sf.ehcache.util.ClassLoaderUtil.createNewInstance(ClassLoaderUtil.java:100)
at net.sf.ehcache.config.ElementValueComparatorConfiguration.createElementComparatorInstance(ElementValueComparatorConfiguration.java:57)
at net.sf.ehcache.Cache.<init>(Cache.java:791)
at net.sf.ehcache.Cache.clone(Cache.java:2761)
at net.sf.ehcache.Cache.clone(Cache.java:163)
at net.sf.ehcache.CacheManager.cloneDefaultCache(CacheManager.java:1945)
at net.sf.ehcache.CacheManager.addCache(CacheManager.java:1218)
Regards
Archana
After make this API changes we are facing one other issue in Liferay 6.2.1 EE .
ehcache class is not loading , we have try to loading this class with different version but no success .
net.sf.ehcache.CacheException:
Unable to load class net.sf.ehcache.store.DefaultElementValueComparator.
Initial cause was net.sf.ehcache.store.DefaultElementValueComparator.<
init>(net.sf.ehcache.config.CacheConfiguration)
at net.sf.ehcache.util.ClassLoaderUtil.createNewInstance(ClassLoaderUtil.java:100)
at net.sf.ehcache.config.ElementValueComparatorConfiguration.createElementComparatorInstance(ElementValueComparatorConfiguration.java:57)
at net.sf.ehcache.Cache.<init>(Cache.java:791)
at net.sf.ehcache.Cache.clone(Cache.java:2761)
at net.sf.ehcache.Cache.clone(Cache.java:163)
at net.sf.ehcache.CacheManager.cloneDefaultCache(CacheManager.java:1945)
at net.sf.ehcache.CacheManager.addCache(CacheManager.java:1218)
Regards
Archana