Issue on Liferary related to caching

Hello Expert,

while enabling  EHCache on contact search drop downs and got below error.  After googling got to know the bug is due to EHCache compatibility with Liferay EE 6.2 due to class loading issue.

Caused by: 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)

if some body has come across this kind of issue, please let me know with a solution..
roy_sanuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gheistCommented:
Please post entire stack trace.
0
roy_sanuAuthor Commented:
pls find it...

 ERROR [localhost-startStop-2][HotDeployImpl:230] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for CacheContactSearch-portletCacheContactSearch-portlet

com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for CacheContactSearch-portletCacheContactSearch-portlet

	at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46)

	at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:128)

	at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:227)

	at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)

	at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:28)

	at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)

	at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)

	at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:44)

	at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:74)

	at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:58)

	at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54)

	at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:116)

	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)

	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)

	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)

	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)

	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)

	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:656)

	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1635)

	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

	at java.util.concurrent.FutureTask.run(Unknown Source)

	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

	at java.lang.Thread.run(Unknown Source)

Caused by: 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.clearCache(FinderCacheImpl.java:74)

	at com.liferay.portal.kernel.dao.orm.FinderCacheUtil.clearCache(FinderCacheUtil.java:31)

	at com.liferay.portal.service.persistence.PortletPersistenceImpl.updateImpl(PortletPersistenceImpl.java:1110)

	at com.liferay.portal.service.persistence.PortletPersistenceImpl.updateImpl(PortletPersistenceImpl.java:1)

	at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.update(BasePersistenceImpl.java:333)

	at com.liferay.portal.service.impl.PortletLocalServiceImpl.updatePortlet(PortletLocalServiceImpl.java:919)

	at com.liferay.portal.service.impl.PortletLocalServiceImpl.checkPortlet(PortletLocalServiceImpl.java:181)

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.lang.reflect.Method.invoke(Unknown Source)

	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.$Proxy72.checkPortlet(Unknown Source)

	at com.liferay.portal.service.PortletLocalServiceUtil.checkPortlet(PortletLocalServiceUtil.java:278)

	at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:467)

	at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:125)

	... 23 more

Caused by: java.lang.NoSuchMethodException: net.sf.ehcache.store.DefaultElementValueComparator.<init>(net.sf.ehcache.config.CacheConfiguration)

	at java.lang.Class.getConstructor0(Unknown Source)

	at java.lang.Class.getConstructor(Unknown Source)

	at net.sf.ehcache.util.ClassLoaderUtil.createNewInstance(ClassLoaderUtil.java:91)

Open in new window

0
gheistCommented:
You need to porvide ehcache JAR files as they do not come included in liferay.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

roy_sanuAuthor Commented:
let me give you some more information... I am sending you snapshot of the liferary 6.2 which was bundled in  tomcat which I downloaded...which was already available without any versions.. but in our pom.xml we are using latest version... is because of in compatibility we are not able deploy ...
if you can provide me assistance, that will resolve this issue...
<?xml version="1.0"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.example.plugins</groupId>
	<artifactId>CacheContactSearch</artifactId>
	<packaging>war</packaging>
	<name>CacheContactSearch Portlet</name>
	<version>1.0.0-SNAPSHOT</version>
	<properties>
	<liferay.maven.plugin.version>6.1.1</liferay.maven.plugin.version>
	<liferay.version>6.1.1</liferay.version>
	</properties>
	<build>
		<plugins>
			<plugin>
				<groupId>com.liferay.maven.plugins</groupId>
				<artifactId>liferay-maven-plugin</artifactId>
				<version>${liferay.maven.plugin.version}</version>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>build-css</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<!-- <autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir>
					<appServerDeployDir>${liferay.app.server.deploy.dir}</appServerDeployDir>
					<appServerLibGlobalDir>${liferay.app.server.lib.global.dir}</appServerLibGlobalDir>
					<appServerPortalDir>${liferay.app.server.portal.dir}</appServerPortalDir> -->
					<liferayVersion>${liferay.version}</liferayVersion>
					<pluginType>portlet</pluginType>
				</configuration>
				
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.5</version>
				<configuration>
					<encoding>UTF-8</encoding>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.5</version>
				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>com.liferay.portal</groupId>
			<artifactId>portal-service</artifactId>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.16</version>
		</dependency>
		
		<dependency>
			<groupId>com.liferay.portal</groupId>
			<artifactId>util-bridges</artifactId>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.liferay.portal</groupId>
			<artifactId>util-taglib</artifactId>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.liferay.portal</groupId>
			<artifactId>util-java</artifactId>
			<version>${liferay.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.portlet</groupId>
			<artifactId>portlet-api</artifactId>
			<version>2.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.4</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>3.0.6.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>3.0.6.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>3.0.6.RELEASE</version>
		</dependency>
		
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>3.0.6.RELEASE</version>
		</dependency>
		
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>3.0.6.RELEASE</version>
		</dependency>
		
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>3.0.6.RELEASE</version>
		</dependency>
		
		
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-expression</artifactId>
			<version>3.0.6.RELEASE</version>
		</dependency>
		
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.6.2</version>
		</dependency>
		
		<dependency>
			<groupId>net.sf.ehcache</groupId>
			<artifactId>ehcache</artifactId>
			<version>2.10.0</version>
		</dependency>

		
		
		<dependency>
			<groupId>aopalliance</groupId>
			<artifactId>aopalliance</artifactId>
			<version>1.0</version>
		</dependency>
		
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
			<version>r09</version>
		</dependency>
		
		
	</dependencies>
</project>

Open in new window

snapshot_Tomcat_jars.png
0
gheistCommented:
Can you place ehcache jar file in any lib directory and stop pasting long sheets of useless xml files?
0
roy_sanuAuthor Commented:
yes I removed the xml stuff,  when I added ehcache 2.9.0  to the lib getting the same error , pls find snapshot
snapshot1.png
0
gheistCommented:
I think that one should be dropped in tomcat's library dir.
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
roy_sanuAuthor Commented:
correct!!!! Cheers....
0
gheistCommented:
liferay sometimes directly patches tomcat configurations, so it should be single on tomcat and then it does not matter which LIB directory you choose.
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.