Forums de discussion

Regarding cache not alive issue

thumbnail
Hitesh Methani, modifié il y a 12 années.

Regarding cache not alive issue

Regular Member Publications: 171 Date d'inscription: 24/06/10 Publications récentes
Hi Folks,

I am using liferay-portal-jboss-6.0, and facing cache not alive issue when using service builder.

Cache of certain custom entity defined in service.xml expires and the cache not alive issue is seen anytime I deploy any portlet containing service.xml.
Root cause and steps for the reproducing issue are not definite.

If portlet A contains certain entity, say entity E, and it's cache expires due to some reason, then even if I deploy portlet B containing service.xml and not containing entity E,
I face cache not alive issue for entity E when I deploy portlet B or portlet A.

Issue gets resolved when I restart the server. I have defined expirtation-cache to be 0 in all the portlets.

Following is the exception trace for the same.


01:13:03,072 INFO  [AutoDeployDir:167] Processing StoreFrontManager-portlet-6.0.12.1.war
01:13:03,077 INFO  [PortletAutoDeployListener:71] Copying portlets for /home/jboss/liferay-portal-6.0-ee-sp2/deploy/StoreFrontManager-portlet-6.0.12.1.war
   Expanding: 
/home/jboss/liferay-portal-6.0-ee-sp2/deploy/StoreFrontManager-portlet-6.0.12.1.war
into /tmp/20111228011303085
   Copying 1 file to /tmp/20111228011303085/WEB-INF
   Copying 1 file to /tmp/20111228011303085/WEB-INF/classes
   Copying 1 file to /tmp/20111228011303085/WEB-INF/classes
   Copying 1 file to /tmp/20111228011303085/WEB-INF/jsp
   Copying 18 files to
/home/jboss/liferay-portal-6.0-ee-sp2/jboss-5.1.0/server/default/deploy/StoreFrontManager-portlet.war
   Copying 1 file to
/home/jboss/liferay-portal-6.0-ee-sp2/jboss-5.1.0/server/default/deploy/StoreFrontManager-portlet.war
   Deleting directory /tmp/20111228011303085
01:13:03,856 INFO  [PortletAutoDeployListener:81] Portlets for /home/jboss/liferay-portal-6.0-ee-sp2/deploy/StoreFrontManager-portlet-6.0.12.1.war
copied successfully. Deployment will start in a few seconds.
01:13:12,421 INFO  [TomcatDeployment] undeploy, ctxPath=/StoreFrontManager-portlet
01:13:12,431 INFO  [PluginPackageUtil:1077] Reading plugin package for StoreFrontManager-portlet 01:13:12,440 ERROR [HotDeployUtil:205]
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error unregistering plugins for StoreFrontManager-portlet
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error unregistering plugins for StoreFrontManager-portlet
     at
com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46)
     at
com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.invokeUndeploy(PluginPackageHotDeployListener.java:63)
     at
com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireUndeployEvent(HotDeployUtil.java:202)
     at
com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireUndeployEvent(HotDeployUtil.java:44)
     at
com.liferay.portal.kernel.servlet.PortletContextListener.doPortalDestroy(PortletContextListener.java:60)
     at
com.liferay.portal.kernel.util.BasePortalLifecycle.portalDestroy(BasePortalLifecycle.java:30)
     at
com.liferay.portal.kernel.servlet.PortletContextListener.contextDestroyed(PortletContextListener.java:45)
     at
org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3949)
     at
org.apache.catalina.core.StandardContext.stop(StandardContext.java:4615)
     at
org.apache.catalina.core.ContainerBase.destroy(ContainerBase.java:1175)
     at
org.apache.catalina.core.StandardContext.destroy(StandardContext.java:4705)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at
org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
     at
org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
     at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
     at
org.jboss.web.tomcat.service.deployers.TomcatDeployment.performUndeployInternal(TomcatDeployment.java:596)
     at
org.jboss.web.tomcat.service.deployers.TomcatDeployment.performUndeploy(TomcatDeployment.java:570)
     at
org.jboss.web.deployers.AbstractWarDeployment.stop(AbstractWarDeployment.java:480)
     at org.jboss.web.deployers.WebModule.stopModule(WebModule.java:133)
     at org.jboss.web.deployers.WebModule.stop(WebModule.java:102)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
     at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
     at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
     at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
     at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
     at
org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
     at $Proxy38.stop(Unknown Source)
     at
org.jboss.system.microcontainer.StartStopLifecycleAction.uninstallAction(StartStopLifecycleAction.java:56)
     at
org.jboss.system.microcontainer.StartStopLifecycleAction.uninstallAction(StartStopLifecycleAction.java:37)
     at
org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleUninstallAction(SimpleControllerContextAction.java:79)
     at
org.jboss.dependency.plugins.action.AccessControllerContextAction.uninstall(AccessControllerContextAction.java:131)
     at
org.jboss.dependency.plugins.AbstractControllerContextActions.uninstall(AbstractControllerContextActions.java:58)
     at
org.jboss.dependency.plugins.AbstractControllerContext.uninstall(AbstractControllerContext.java:354)
     at
org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:1664)
     at
org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:1275)
     at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:827)
     at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
     at
org.jboss.system.ServiceController.doChange(ServiceController.java:688)
     at org.jboss.system.ServiceController.stop(ServiceController.java:510)
     at
org.jboss.system.deployers.ServiceDeployer.stop(ServiceDeployer.java:170)
     at
org.jboss.system.deployers.ServiceDeployer.undeploy(ServiceDeployer.java:150)
     at
org.jboss.system.deployers.ServiceDeployer.undeploy(ServiceDeployer.java:46)
     at
org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalUndeploy(AbstractSimpleRealDeployer.java:69)
     at
org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.undeploy(AbstractRealDeployer.java:112)
     at
org.jboss.deployers.plugins.deployers.DeployerWrapper.undeploy(DeployerWrapper.java:196)
     at
org.jboss.deployers.plugins.deployers.DeployersImpl.doUndeploy(DeployersImpl.java:1469)
     at
org.jboss.deployers.plugins.deployers.DeployersImpl.doUninstallParentLast(DeployersImpl.java:1376)
     at
org.jboss.deployers.plugins.deployers.DeployersImpl.doUninstallParentLast(DeployersImpl.java:1369)
     at
org.jboss.deployers.plugins.deployers.DeployersImpl.uninstall(DeployersImpl.java:1331)
     at
org.jboss.dependency.plugins.AbstractControllerContext.uninstall(AbstractControllerContext.java:354)
     at
org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:1664)
     at
org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:1275)
     at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:827)
     at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
     at
org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:694)
     at
org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679)
     at
org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
     at
org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
     at
org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
     at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
     at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
     at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
     at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
     at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
     at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
     at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
     at java.lang.Thread.run(Thread.java:662)
Caused by: com.liferay.portal.kernel.exception.SystemException: 
org.hibernate.cache.CacheException: java.lang.IllegalStateException: The com.hungama.gdp.webservice.model.impl.OfferPlanImpl Cache is not alive.
     at
com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.destroyServiceComponent(ServiceComponentLocalServiceImpl.java:65)
     at sun.reflect.GeneratedMethodAccessor4947.invoke(Unknown Source)
     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
     at
com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:86)
     at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:60)
     at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:60)
     at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:60)
     at
com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:93)
     at $Proxy481.destroyServiceComponent(Unknown Source)
     at
com.liferay.portal.service.ServiceComponentLocalServiceUtil.destroyServiceComponent(ServiceComponentLocalServiceUtil.java:262)
     at
com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.destroyServiceComponent(PluginPackageHotDeployListener.java:72)
     at
com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.doInvokeUndeploy(PluginPackageHotDeployListener.java:146)
     at
com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.invokeUndeploy(PluginPackageHotDeployListener.java:60)
     ... 73 more
Caused by: org.hibernate.cache.CacheException: 
java.lang.IllegalStateException: The
com.hungama.gdp.webservice.model.impl.OfferPlanImpl Cache is not alive.
     at net.sf.ehcache.hibernate.EhCache.clear(EhCache.java:178)
     at
com.liferay.portal.dao.orm.hibernate.CacheWrapper.invalidate(CacheWrapper.java:130)
     at
com.liferay.portal.cache.CacheRegistryImpl.clear(CacheRegistryImpl.java:41)
     at
com.liferay.portal.kernel.cache.CacheRegistryUtil.clear(CacheRegistryUtil.java:23)
     at
com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.clearCacheRegistry(ServiceComponentLocalServiceImpl.java:274)
     at
com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.destroyServiceComponent(ServiceComponentLocalServiceImpl.java:62)
     ... 87 more
Caused by: java.lang.IllegalStateException: The com.hungama.gdp.webservice.model.impl.OfferPlanImpl Cache is not alive.
     at net.sf.ehcache.Cache.checkStatus(Cache.java:2191)
     at net.sf.ehcache.Cache.removeAll(Cache.java:1978)
     at net.sf.ehcache.Cache.removeAll(Cache.java:1964)
     at net.sf.ehcache.hibernate.EhCache.clear(EhCache.java:176)
     ... 92 more
01:13:12,441 INFO  [PortletHotDeployListener:445] Unregistering portlets for StoreFrontManager-portlet
01:13:12,442 INFO  [PortletHotDeployListener:477] 1 portlet for StoreFrontManager-portlet was unregistered
01:13:12,444 INFO  [[/StoreFrontManager-portlet]] Closing Spring root WebApplicationContext 01:13:13,400 INFO  [TomcatDeployment] deploy, ctxPath=/StoreFrontManager-portlet
01:13:13,535 INFO  [[/StoreFrontManager-portlet]] Initializing Spring root WebApplicationContext Loading vfsfile:/home/jboss/liferay-portal-6.0-ee-sp2/jboss-5.1.0/server/default/deploy/StoreFrontManager-portlet.war/WEB-INF/classes/service.properties
Loading
vfsfile:/home/jboss/liferay-portal-6.0-ee-sp2/jboss-5.1.0/server/default/deploy/StoreFrontManager-portlet.war/WEB-INF/classes/service.properties
01:13:18,218 INFO  [PluginPackageUtil:1077] Reading plugin package for StoreFrontManager-portlet Loading vfsfile:/home/jboss/liferay-portal-6.0-ee-sp2/jboss-5.1.0/server/default/deploy/StoreFrontManager-portlet.war/WEB-INF/classes/service.properties
Loading
vfsfile:/home/jboss/liferay-portal-6.0-ee-sp2/jboss-5.1.0/server/default/deploy/StoreFrontManager-portlet.war/WEB-INF/classes/portlet.properties
Loading
vfsfile:/home/jboss/liferay-portal-6.0-ee-sp2/jboss-5.1.0/server/default/deploy/StoreFrontManager-portlet.war/WEB-INF/classes/portlet.properties
01:13:18,575 INFO  [PortletHotDeployListener:251] Registering portlets for StoreFrontManager-portlet Loading vfsfile:/home/jboss/liferay-portal-6.0-ee-sp2/jboss-5.1.0/server/default/deploy/StoreFrontManager-portlet.war/WEB-INF/classes/portlet.properties
01:13:18,621 INFO  [PortletHotDeployListener:410] 1 portlet for StoreFrontManager-portlet is available for use


OfferPlan Entity which causes the issue is not part of StoreFrontManager-portlet which is deployed.

Has anyone faced the same issue, any pointers for the same would be helpful.

Thanks and Regards,
Hitesh Methani.
thumbnail
Hitesh Methani, modifié il y a 12 années.

RE: Regarding cache not alive issue

Regular Member Publications: 171 Date d'inscription: 24/06/10 Publications récentes
Got relieved,
This error occurs due to different service.xml using same entity name with change in model column name.

Regards,
Hitesh Methani.
thumbnail
Navaraj Neupane, modifié il y a 11 années.

Regarding cache not alive issue(liferay-portal-tomcat 6.1.1)

New Member Publications: 2 Date d'inscription: 15/04/13 Publications récentes
I had replica of this error while using tomcat too. Basically error was occurred when I was using portlet with services. If I redeployed portlet and try to use it without restarting server, this error occurred. Currently I made a small change in portlet.xml and it worked fine for me.

I just replaced
<expiration-cache>0</expiration-cache>
in portlet.xml with
<expiration-cache>-1</expiration-cache>
. Here value '-1' represents 'cache will never expire'.

I hope this will help with tomcat.

Regards,
Navaraj Neupane
thumbnail
Navaraj Neupane, modifié il y a 10 années.

RE: Regarding cache not alive issue(liferay-portal-tomcat 6.1.1)

New Member Publications: 2 Date d'inscription: 15/04/13 Publications récentes
One more way to resolve this issue(plz be noted it will make the system slow).

Add:
hibernate.cache.use_query_cache=false
hibernate.cache.use_second_level_cache=false

inside portal-ext.properties inside your liferay bundle.
thumbnail
Jack Bakker, modifié il y a 10 années.

RE: Regarding cache not alive issue(liferay-portal-tomcat 6.1.1)

Liferay Master Publications: 978 Date d'inscription: 03/01/10 Publications récentes
Not sure if it helps, but I saw a similar issue after changing package naming from ca.clientname.server.service to ca.clientname.server.services

where to fix I had to

- delete /docroot/WEB-INF/service
- delete /docroot/WEB-INF/classes
- update /docroot/js/services.js
- clean
- rebuild services
- check dependent portlets includes
thumbnail
David García González, modifié il y a 11 années.

RE: Regarding cache not alive issue

Regular Member Publications: 127 Date d'inscription: 14/07/09 Publications récentes
Hitesh Methani:

Issue gets resolved when I restart the server. I have defined expirtation-cache to be 0 in all the portlets.
Hitesh Methani.

Hi, I am experiencing the same issue. How you define the expiration-cache to 0 in the portlet?

Thanks.
thumbnail
Hitesh Methani, modifié il y a 11 années.

RE: Regarding cache not alive issue

Regular Member Publications: 171 Date d'inscription: 24/06/10 Publications récentes
Hi David,

Expiration cache is 0 by default for all the portlets in portlet.xml, I am not sure it is related to this issue or not, I was just providing the detailed info if it might be related.
The actual cause of the issue in my case was change in entity column names in service.xml of different portlets. Check if your entity is not defined in service.xml of two different portlets.

Thanks and Regards,
Hitesh Methani.
thumbnail
David García González, modifié il y a 11 années.

RE: Regarding cache not alive issue

Regular Member Publications: 127 Date d'inscription: 14/07/09 Publications récentes
Hitesh Methani:
Check if your entity is not defined in service.xml of two different portlets.

Hitesh Methani.


Hi. This entity is only placed in one service.xml, but there is 2 different things to take in account:

1.- In one portlet I have 2 service.xml.
2.- The jar xxx-portlet-service.jar is placed in another war and in the global lib directory because I have to use its methods from one hook plugin.

Could this error be happening due to one of these things??

Thank you very much!
thumbnail
Hitesh Methani, modifié il y a 11 années.

RE: Regarding cache not alive issue

Regular Member Publications: 171 Date d'inscription: 24/06/10 Publications récentes
Hello David,


2.- The jar xxx-portlet-service.jar is placed in another war and in the global lib directory because I have to use its methods from one hook plugin.

Point number 2 you mentioned seems to be creating the problem causing duplication, xxx-portlet-service.jar if placed in global lib, it should be removed from libs of any other wars.

Thanks and Regards,
Hitesh Methani
thumbnail
David García González, modifié il y a 11 années.

RE: Regarding cache not alive issue

Regular Member Publications: 127 Date d'inscription: 14/07/09 Publications récentes
Thanks!!!

The thing is that I wanted to remove the xxx-service.jar from the global lib, but I need it to call the services from the jsp /journal_content/view.jsp that is placed within a hook.

Example:
List<socialmedia> list = SocialmediaLocalServiceUtil.findByCompanyId(themeDisplay.getCompanyId());</socialmedia>


Is it possible to call these services from a hook and having the services jar only inside the portlet war?
thumbnail
Hitesh Methani, modifié il y a 11 années.

RE: Regarding cache not alive issue

Regular Member Publications: 171 Date d'inscription: 24/06/10 Publications récentes
Hi David,

In your case I would suggest you to bundle hook and porltet in a single war, which would remove the dependency problem,
You can refer the link hook an d portlet in single war.

Best Regards,
Hitesh
thumbnail
Hitoshi Ozawa, modifié il y a 11 années.

RE: Regarding cache not alive issue

Liferay Legend Publications: 7942 Date d'inscription: 24/03/10 Publications récentes
Is it possible to call these services from a hook and having the services jar only inside the portlet war?


You only need service jar in lib\ext and not in your portlet.

That said, I agree with Hitesh. It would be easier if you just bundle everything into one war.
Akram MONCER, modifié il y a 11 années.

RE: Regarding cache not alive issue

Regular Member Publications: 106 Date d'inscription: 25/09/12 Publications récentes
hi
i try the solution about packaging the hook and the portlet in the same war, the problem is if the jar generated by the service builder is in the portlet lib folder, the jsp pages from the hook can't see it because they will be deployed on other portlet, and when i remove the jar from the portlet lib and put it in the /lib/ext under tomcat folder i get cache not alive
Michael Lustenberger, modifié il y a 11 années.

RE: Regarding cache not alive issue

New Member Envoyer: 1 Date d'inscription: 02/10/12 Publications récentes
Hello Akram,

maybe it is not the right answer for you, but in our case I found a
quite easy solution for this error, and I hope it might possibly
help at least someone out there.

Our summarized setup:
We got some portlets (name them: 'bar'..s) all depending on one
portlet ('foo') created with service-builder. I did not want to
manually copy jars to the container or the like, so the 'foo.jar'
is put inside every 'bar.war' and the runtime context is set as
'required-deployment-contexts=foo' in liferay-plugin-package.properties..

The problem:
Now any time I redeployed the (dependent) 'bar' portlet, I got the
before mentioned Error. After a container restart, everything was
fine again (though not an option on producive systems).

An explanation (please correct me, if wrong..):
After some forum visits and playing around, I now think to understand
(or guess), this is due to the Singleton hibernate cache to be
undeployed on redeploy of 'bar'.

A solution:
So I just tried the obvious (maybe too obvious for the involved and
that is why it was not mentioned here before..): As soon as I redeploy
'foo' everything is back to normal again. So basically after each change
in 'bar' we redeploy first 'bar', than 'foo'.

Alternative (?):
Tell bar to leave cache alone??

Yours,
mic