5
votes

I have created a custom Liferay 6.2 portlet using Grails 2.0.4, the Portlets Plugin 0.9.2, and Liferay Portlets Plugin 0.4.

I am getting a strange error after deploying the portlet. Here is what happens:

  1. Upload the WAR file through the web interface
  2. Add the portlet to a page
  3. Receive an error that says "There was an unexpected error. Please refresh the current page."
  4. Refresh the page to find that none of the portlets on the page work anymore, and the following error is displayed: "Internal Server Error - An error occurred while accessing the requested resource." (see the image below)

The logs indicate the following error:

com.liferay.portal.NoSuchResourceActionException: <Portlet>_WAR_<PortletApp>#VIEW

I've seen other instances where the "#VIEW" says "#ADD_TO_PAGE". Please note that the portlet is deploying and working just fine on my vanilla version of Liferay 6.2 that I use for development.

Does anyone know what the issue could possibly be? Thank you.

Stacktrace:

Jan 16, 2014 10:42:40 AM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
com.liferay.portal.NoSuchResourceActionException: <Portlet>_WAR_<PortletApp>#VIEW
    at com.liferay.portal.service.impl.ResourceActionLocalServiceImpl.getResourceAction(ResourceActionLocalServiceImpl.java:196)
    at sun.reflect.GeneratedMethodAccessor308.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
    at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
    at com.sun.proxy.$Proxy85.getResourceAction(Unknown Source)
    at com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl.doUpdateResourcePermission(ResourcePermissionLocalServiceImpl.java:1190)
    at com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl.updateResourcePermission(ResourcePermissionLocalServiceImpl.java:1312)
    at com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl.setOwnerResourcePermissions(ResourcePermissionLocalServiceImpl.java:1038)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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)

The error after adding the portlet and refreshing the page

3
Did you ever figure this out? I'm getting the same error on my new install of Liferay 6.2 GA1. Thanks!acvcu
I put my fix as an answer below. Good luck.grantmcconnaughey

3 Answers

4
votes

The problem ended up being higher in the stacktrace. I was receiving the following error:

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

I was able to fix the problem by reading this link. Here are the steps I took:

  1. Navigate to $liferay_home/tomcat/webapps/ROOT/WEB-INF/lib/
  2. Copy ehcache.jar somewhere to back it up (like the root $liferay_home directory)
  3. Copy ehcache.jar again somewhere to work with it (like the desktop)
  4. Change the name ehcache.jar to ehcache.zip
  5. Unzip the ehcache.zip file
  6. Copy the updated ClassLoaderUtil.class file to the folder's net/sf/ehcache/util/ directory, replacing the current ClassLoaderUtil.class file.
  7. Zip the ehcache directory
  8. Change the name ehcache.zip to ehcache.jar
  9. Put this new ehcache.jar file in $liferay_home/tomcat/webapps/ROOT/WEB-INF/lib/, replacing the current ehcache.jar
0
votes

I don't know how portlets work wih grails but your error can be fixed by resolving how to define permission using grails.

Liferay official documentation about permissions can be found here : http://www.liferay.com/community/wiki/-/wiki/Main/Permissioning+in+Plugin+Environment#section-Permissioning+in+Plugin+Environment-DEFINING+PERMISSION+FOR+A+PORTLET+RESOURCE+IN+PLUGIN+ENVIRONMENT

0
votes

Since I use ehcache-2.10.4.jar in my project, I had the same issue after upgrading to Liferay EE 6.2.10 EE GA1. So instead of fiddling with compiled classes, I replaced ehcache.jar in the $liferay_home/tomcat/webapps/ROOT/WEB-INF/lib/ directory with the one that is provided by the Maven dependency.