Fórumok

Unable to load class net.sf.ehcache.store.DefaultElementValueComparator

fstn fs, módosítva 8 év-val korábban

Unable to load class net.sf.ehcache.store.DefaultElementValueComparator

Junior Member Bejegyzések: 63 Csatlakozás dátuma: 2014.10.03. Legújabb bejegyzések
Hi, I trying to get request user info by using

Map<string, object> userInfo = (Map<string, object>) request.getAttribute(PortletRequest.USER_INFO);
</string,></string,>

And I always have this stacktrace:

09:48:39,213 ERROR [http-bio-8090-exec-104][UserAttributes:311] 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)
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)
	at com.liferay.portal.cache.ehcache.EhcachePortalCacheManager.addCache(EhcachePortalCacheManager.java:241)
	at com.liferay.portal.cache.ehcache.EhcachePortalCacheManager.getCache(EhcachePortalCacheManager.java:136)
	at com.liferay.portal.cache.MultiVMPoolImpl.getCache(MultiVMPoolImpl.java:47)
	at com.liferay.portal.dao.orm.common.FinderCacheImpl._getPortalCache(FinderCacheImpl.java:231)
	at com.liferay.portal.dao.orm.common.FinderCacheImpl.getResult(FinderCacheImpl.java:120)
	at com.liferay.portal.kernel.dao.orm.FinderCacheUtil.getResult(FinderCacheUtil.java:47)
	at com.liferay.portal.service.persistence.AddressPersistenceImpl.findByC_C_C(AddressPersistenceImpl.java:2792)
	at com.liferay.portal.service.persistence.AddressPersistenceImpl.findByC_C_C(AddressPersistenceImpl.java:2728)
	at com.liferay.portal.service.impl.AddressLocalServiceImpl.getAddresses(AddressLocalServiceImpl.java:153)
	at sun.reflect.GeneratedMethodAccessor335.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
	at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
	at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
	at com.sun.proxy.$Proxy15.getAddresses(Unknown Source)
	at com.liferay.portal.service.AddressLocalServiceUtil.getAddresses(AddressLocalServiceUtil.java:345)
	at com.liferay.portal.model.impl.UserImpl.getAddresses(UserImpl.java:104)
	at com.liferay.portlet.UserAttributes.<init>(UserAttributes.java:268)
	at com.liferay.portlet.UserInfoFactory.getUserInfo(UserInfoFactory.java:90)
	at com.liferay.portlet.UserInfoFactory.getUserInfo(UserInfoFactory.java:73)
	at com.liferay.portlet.PortletRequestImpl.getUserInfo(PortletRequestImpl.java:531)
	at com.liferay.portlet.PortletRequestImpl.getAttribute(PortletRequestImpl.java:155)
	at javax.portlet.filter.PortletRequestWrapper.getAttribute(PortletRequestWrapper.java:62)
</init></init></init></init>


how can I disable this cache?


Thank you for reading
thumbnail
David H Nebinger, módosítva 8 év-val korábban

RE: Unable to load class net.sf.ehcache.store.DefaultElementValueComparator

Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
You don't want to disable the cache, you want to change your code so you access user info correctly, namely by invoking the UserLocalServiceUtil methods.
fstn fs, módosítva 8 év-val korábban

RE: Unable to load class net.sf.ehcache.store.DefaultElementValueComparator

Junior Member Bejegyzések: 63 Csatlakozás dátuma: 2014.10.03. Legújabb bejegyzések
Thank you, it's work with


	FacesContext fc = FacesContext.getCurrentInstance();

		if (fc == null) {
			return null;
		}

		User user = null;
		ExternalContext externalContext = fc.getExternalContext();
		if (externalContext.getUserPrincipal() == null) {
			logger.info("current user is null");
		} else {
			Long id = Long.parseLong(externalContext.getUserPrincipal().getName());
			try {
				user = UserLocalServiceUtil.getUserById(id);
			} catch (PortalException ex) {
				logger.error("Can't get current User", ex);
			} catch (SystemException ex) {
				logger.error("Can't get current User", ex);
			}
		}
		return user;

thumbnail
David H Nebinger, módosítva 8 év-val korábban

Re: Unable to load class net.sf.ehcache.store.DefaultElementValueComparator

Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
FacesContext fc = FacesContext.getCurrentInstance();


Faces? Dude, if you're going to post a question about faces, get it in the right group. Answers can be totally different from general dev and there may be better answers for you elsewhere.

I've moved to the faces category for others to chime in...
thumbnail
Neil Griffin, módosítva 8 év-val korábban

RE: Re: Unable to load class net.sf.ehcache.store.DefaultElementValueCompar

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
I would recommend the following instead:

ThemeDisplay themeDisplay = (ThemeDisplay) externalContext.getRequestMap().get(WebKeys.THEME_DISPLAY);
User user = themeDisplay.getUser();