1

我正在尝试向 Liferay 用户发布登录操作添加一个挂钩,因此我创建了 liferay-hook.xml 指向 portal.properties,它指向我的类:

public class PostLoginActionHook extends Action {

@Override
public void run(HttpServletRequest request, HttpServletResponse response)
        throws ActionException {
    try {
        runExceptionThrowing(request, response);
    } catch (Exception e) {
        e.printStackTrace();
        throw new ActionException(e);
    }
}

但是在服务器启动时出现以下异常:

SEVERE: Unable to initialize PropsUtil
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:394)
at java.util.Properties.setProperty(Properties.java:143)
at java.lang.System.setProperty(System.java:729)
at com.liferay.portal.kernel.util.SystemProperties.set(SystemProperties.java:52)
at com.liferay.portal.util.PropsUtil.<init>(PropsUtil.java:172)
at com.liferay.portal.util.PropsUtil.<clinit>(PropsUtil.java:323)
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 com.liferay.portal.kernel.util.MethodHandler.invoke(MethodHandler.java:77)
at com.liferay.portal.kernel.util.PortalClassInvoker.invoke(PortalClassInvoker.java:42)
at com.liferay.portal.kernel.util.PropsUtil.get(PropsUtil.java:32)
at com.liferay.util.log4j.Log4JUtil._getLiferayHome(Log4JUtil.java:193)
at com.liferay.util.log4j.Log4JUtil._getURLContent(Log4JUtil.java:201)
at com.liferay.util.log4j.Log4JUtil.configureLog4J(Log4JUtil.java:67)
at com.liferay.util.log4j.Log4JUtil.configureLog4J(Log4JUtil.java:57)
at com.liferay.portal.util.InitUtil.init(InitUtil.java:94)
at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:134)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

有人处理过吗?

我正在使用 Liferay 6.1

问候

4

1 回答 1

0

从来没有处理过。

但是您可以尝试扩展 BaseStrutsAction 而不是 Action。当我覆盖一个动作时,这就是我所做的。

于 2012-09-06T14:15:49.817 回答