简体   繁体   中英

ClassNotFoundException LoginAction while hook is deploying

I am using hook to overide the default LoginAction through hooks.

But I am getting this Exception:

Caused by: java.lang.ClassNotFoundException: com.liferay.portlet.login.action.LoginAction

This is how I am doing it:

liferay-hook.xml

<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.1.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_1_0.dtd">

<hook>
   <struts-action>
    <struts-action-path>/login/login</struts-action-path>
    <struts-action-impl>com.liferay.samplehook.action.SampleStrutsAction</struts-action-impl> 
    </struts-action>
</hook>

You can not refer to portal-impl classes from plugin hook.

You should extend BaseStrutsPortletAction.java from portal-service in your case.

You can refer to sample-struts-action-hook

Regards

This error also has a NoClassDefFoundError. Here's an explanation. Hope this helps.

  1. java.lang.ClassNotFoundException This exception indicates that the class was not found on the classpath. This indicates that we were trying to load the class definition, and the class did not exist on the classpath.
  2. java.lang.NoClassDefFoundError This exception indicates that the JVM looked in its internal class definition data structure for the definition of a class and did not find it. This is different than saying that it could not be loaded from the classpath. Usually this indicates that we previously attempted to load a class from the classpath, but it failed for some reason - now we're trying to use the class again (and thus need to load it, since it failed last time), but we're not even going to try to load it, because we failed loading it earlier (and reasonably suspect that we would fail again). The earlier failure could be a ClassNotFoundException or an ExceptionInInitializerError (indicating a failure in the static initialization block) or any number of other problems. The point is, a NoClassDefFoundError is not necessarily a classpath problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM