留言板

NoSuchResourceException

Klaus Bachmaier,修改在8 年前。

NoSuchResourceException

Regular Member 帖子: 223 加入日期: 13-9-30 最近的帖子
I've includes a JSP Snippet into one of my JSPs wich should provide me a <liferay-ui:icon-menu>

I use a permissionChecker around each entry in my icon-menu to check if the current user may edit or delete the actual entry in my search-container-row.

I'm using custom Tags, so the whole thing looks like this:


<liferay-ui:icon-menu>
	<custom:checkpermissions action="PERMISSIONS">
		<liferay-ui:icon image="permissions" message="Edit" url="${permissionsURL}" />
	</custom:checkpermissions>

...
</liferay-ui:icon-menu>


When I deploy the portlet and try to open the Permissions Dialogue of an Entry in my search-container-row I get an Exception like this:

14:47:01,731 ERROR [http-bio-8080-exec-334][IncludeTag:129] Current URL /web/guest/books?p_p_id=86&p_p_lifecycle=0&p_p_state=maximized&p_p_col_id=column-2&p_p_col_count=1&_86_struts_action=%2Fportlet_configuration%2Fedit_permissions&_86_redirect=%2Fweb%2Fguest%2Fbooks&_86_returnToFullPageURL=%2Fweb%2Fguest%2Fbooks&_86_portletResource=SpringBook_WAR_SpringBookportlet&_86_modelResource=com.mycompany.test.liferay.model.Book&_86_modelResourceDescription=Game+of+Thrones&_86_resourceGroupId=10180&_86_resourcePrimKey=28208 generates exception: com.liferay.portal.NoSuchResourceActionException: com.mycompany.test.liferay.model.Book#PERMISSIONS
com.liferay.portal.NoSuchResourceActionException: com.mycompany.test.liferay.model.Book#PERMISSIONS

I'm using Maven to build and deploy my project. Just to make sure I've placed my Files at the right location:

default.xml is in: /src/main/resources/resource-actions

portlet.properties is in /src/main/resources and this is the content of portlet.properties:

resource.actions.configs=resource-actions/default.xml


This a snippet from default.xml


<resource-action-mapping>
	<model-resource>
		<model-name> com.mycompany.test.liferay.model.Book</model-name>
		<portlet-ref>
			<portlet-name>book</portlet-name>
		</portlet-ref>
		<permissions>
			<supports>
				<action-key>DELETE</action-key>
				<action-key>PERMISSIONS</action-key>
				<action-key>UPDATE</action-key>
				<action-key>VIEW</action-key>
			</supports>
</permissions></model-resource></resource-action-mapping>


So yes, ActionKey.PERMISSIONS should be there.

1.) Are my Configuration Files at the right location?
2.) What is the Meaning of these Exceptions? How may I get rid of it?
thumbnail
Olaf Kock,修改在8 年前。

RE: NoSuchResourceException

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
Copy/Paste/Change issue or the actual one? You're mentioning com.mycompany.test.liferay.model.Book#PERMISSIONS as well as de.inovex.academy.liferay.model.Book.

It'd be nice if it would be that simple (but easy to miss) emoticon
Klaus Bachmaier,修改在8 年前。

RE: NoSuchResourceException

Regular Member 帖子: 223 加入日期: 13-9-30 最近的帖子
You've got me. I just tried to anonymize my code I've got from a training session ;-) No, it's not that simple, because naming of my classes and packages is consistent in the real code.

38 Degrees Celsius are too much to work with code.
thumbnail
Peter Dimitri,修改在8 年前。

RE: NoSuchResourceException

Junior Member 帖子: 48 加入日期: 13-1-9 最近的帖子
If you haven't changed the code too much, it should work out of the box. I really remember this Exercise ;-)

Please give it a try on a fresh Liferay Installation.
Klaus Bachmaier,修改在8 年前。

RE: NoSuchResourceException

Regular Member 帖子: 223 加入日期: 13-9-30 最近的帖子
Don't understand why, but there where 12 different Directories about my portlet under <tomcat-dir>/temp/. After I cleaned up my tomcat manually and deployed everything again, it worked. Thanks.
thumbnail
Ravi Kumar Gupta,修改在8 年前。

RE: NoSuchResourceException

Liferay Legend 帖子: 1302 加入日期: 09-6-24 最近的帖子
There would be even more directories. Tomcat would create one directory per deployment of your portlet(s) war file. Usually the one latest modified is the one carrying your latest code. Rest should be empty.
Klaus Bachmaier,修改在8 年前。

RE: NoSuchResourceException

Regular Member 帖子: 223 加入日期: 13-9-30 最近的帖子
Unfortunately the Problem is still extisting, and I simply want to understand where these NoSuchResourceActionException come from. Is it a misconfiguration in my Projects File structure? (default.xml or portlet.properties Files at the wrong location?)

Did I miss something in my Service? When I add a "Book" Objekt I also add a Resource like this:


ResourceLocalServiceUtil.addResources(companyId, groupId, userId, Book.class.getName(), book.getId(), false, true, true);


Sometime when I open my JSP were this Portlet is placed, I get thousands of Lines of Stacktraces because of these Exceptions, sometimes th ePage openes without any Exception. Weird!

Anyway: Each Row in my search-container has a <liferay-ui:icon menu> in this menu I have an Option to set permissons with this <liferay-security:permissions-url>

<liferay-security:permissionsurl modelResource="${modelClassName}" modelResourceDescription="${bookTitle}" resourcePrimKey="${bookID}" var="permissionsURL" />
...
...

<liferay-ui:icon image="permissions" url="${permissionsURL}" />


When I try to open the permissions dialogue I get plenty of these

09:55:56,286 ERROR [http-bio-8080-exec-10][AdvancedPermissionChecker:941] com.liferay.portal.NoSuchResourceActionException: com.mycompany.test.model.Book#PERMISSIONS
com.liferay.portal.NoSuchResourceActionException: com.mycompany.test.model.Book#PERMISSIONS
        at com.liferay.portal.service.impl.ResourceActionLocalServiceImpl.getResourceAction(ResourceActionLocalServiceImpl.java:196)
        at sun.reflect.GeneratedMethodAccessor312.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)


Any hint on how I may get rid of these Exceptions so that I may succeffully open the Permissions Dialogue on my Entities?
thumbnail
Peter Dimitri,修改在8 年前。

RE: NoSuchResourceException

Junior Member 帖子: 48 加入日期: 13-1-9 最近的帖子
If you are still working on the Training Example: Check the Portlet name in your default.xml ;-)