2

我正在尝试为会议注册 portlet 配置权限。我已将 portlet.properties 文件添加到我的 portlet 的 docroot/WEB-INF/src 目录中。添加以下行会导致异常:

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

default.xml 看起来像这样:

<?xml version="1.0"?>
<!DOCTYPE resource-action-mapping PUBLIC "-//Liferay//DTD Resource Action Mapping 6.1.0//EN" "http://www.liferay.com/dtd/liferay-resource-action-mapping_6_1_0.dtd">

 <resource-action-mapping>
   <resource file="resource-actions/meetingsignup.xml" />
 </resource-action-mapping>

meetingingup.xml 如下所示:

<?xml version="1.0"?>
<resource-action-mapping>
    <portlet-resource>
        <portlet-name>meeting_signup</portlet-name>
        <permissions>
            <supports>
                <action-key>CREATE_MEETING</action-key>
                <action-key>VIEW</action-key>
            </supports>
            <community-defaults>
                <action-key>VIEW</action-key>
                <action-key>CREATE_MEETING</action-key>
            </community-defaults>
            <guest-defaults>
                <action-key>VIEW</action-key>
                <action-key>CREATE_MEETING</action-key>
            </guest-defaults>
            <user-defaults>
                <action-key>VIEW</action-key>
                <action-key>CREATE_MEETING</action-key>
            </user-defaults>
        </permissions>
    </portlet-resource>
    <model-resource>
        <model-name>edu.pointloma.liferay.portlet.service.MeetingSignUp.model.Event</model-name>
        <portlet-ref>
            <portlet-name>meeting_signup</portlet-name>
        </portlet-ref>
        <permissions>
            <supports>
                <action-key>REGISTER</action-key>
                <action-key>VIEW_REPORT</action-key>
                <action-key>EDIT</action-key>
                <action-key>DELETE</action-key>
            </supports>
            <community-defaults>
                <action-key>REGISTER</action-key>
            </community-defaults>
            <guest-defaults>
                <action-key>REGISTER</action-key>
            </guest-defaults>
            <user-defaults>
                <action-key>REGISTER</action-key>
            </user-defaults>
            <power-user-defaults>
                <action-key>REGISTER</action-key>
            </power-user-defaults>
        </permissions>
    </model-resource>
</resource-action-mapping>

即,当我部署 portlet 时,日志写道:

12:36:07,035 ERROR [HotDeployUtil:112]com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for meeting_sign-up-portlet
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for meeting_sign-up-portlet
    at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:45)
    at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:105)
    at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:109)
    at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:183)
    at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:38)
    at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit(PortletContextListener.java:99)
    at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
    at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
    at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:51)
    at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
    at com.liferay.portal.kernel.servlet.PortletContextListener.contextInitialized(PortletContextListener.java:55)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1244)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
    at com.liferay.portal.security.permission.ResourceActionsUtil._readActionKeys(ResourceActionsUtil.java:942)
    at com.liferay.portal.security.permission.ResourceActionsUtil._readSupportsActions(ResourceActionsUtil.java:1212)
    at com.liferay.portal.security.permission.ResourceActionsUtil._readPortletResource(ResourceActionsUtil.java:1106)
    at com.liferay.portal.security.permission.ResourceActionsUtil._read(ResourceActionsUtil.java:921)
    at com.liferay.portal.security.permission.ResourceActionsUtil._read(ResourceActionsUtil.java:909)
    at com.liferay.portal.security.permission.ResourceActionsUtil.read(ResourceActionsUtil.java:412)
    at com.liferay.portal.deploy.hot.PortletHotDeployListener.processPortletProperties(PortletHotDeployListener.java:603)
    at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:313)
    at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:102)
    ... 20 more

为什么会发生此异常,我该如何摆脱它?我已经在网上搜索了答案,但我找不到答案。

4

1 回答 1

2
  1. Try removing the first slash: resource.actions.configs=resource-actions/default.xml
  2. double check that default.xml exists and that it is in a folder named resource-actions and that folder is under WEB-INF/src folder together with portlet.properties
  3. Open default.xml and make sure its internal structure is compliant with Liferay Resource Mapping DTD (prev. link is for Liferay 6.1)
于 2012-11-13T21:08:06.590 回答