Foros de discusión
DefaultLandingPageAction Hook - class not found Exception
Gnaniyar Zubair, modificado hace 12 años.
DefaultLandingPageAction Hook - class not found Exception
Liferay Master Mensajes: 722 Fecha de incorporación: 19/12/07 Mensajes recientes
Hi,
I've developed event hook for DefaultLandingPageAction with my CustomDefaultPageAction through hooks plugin in Liferay 6. But I am getting CLASS NOT FOUND EXCEPTION for this class PrefsPropsUtil
which is loaded from portal-impl. It is fixed when i change that path to portal-kernel path
Actually, other classes mentioned below which are loaded from portal-impl , are not throwing any exception.
issue with only PrefsPropsUtil. Can anybody throw some lights on this?
Thanks
Gnaniyar Zubair
I've developed event hook for DefaultLandingPageAction with my CustomDefaultPageAction through hooks plugin in Liferay 6. But I am getting CLASS NOT FOUND EXCEPTION for this class PrefsPropsUtil
[b]import com.liferay.portal.util.PrefsPropsUtil;[/b]
which is loaded from portal-impl. It is fixed when i change that path to portal-kernel path
[b]import com.liferay.portal.kernel.util.PrefsPropsUtil[/b];
Actually, other classes mentioned below which are loaded from portal-impl , are not throwing any exception.
[b]import com.liferay.portal.util.PortalUtil;
import com.liferay.portal.util.WebKeys[/b];
issue with only PrefsPropsUtil. Can anybody throw some lights on this?
Thanks
Gnaniyar Zubair
Ravi Kumar Gupta, modificado hace 12 años.
RE: DefaultLandingPageAction Hook - class not found Exception
Liferay Legend Mensajes: 1302 Fecha de incorporación: 24/06/09 Mensajes recientes
Thats strange.. I just created one and its working fine..
import com.liferay.portal.kernel.events.Action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.struts.LastPath;
import com.liferay.portal.kernel.util.PrefsPropsUtil;
import com.liferay.portal.kernel.util.PropsKeys;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.util.PortalUtil;
public class MyCustomPostAction extends Action {
/* (non-Java-doc)
* @see com.liferay.portal.kernel.events.Action#Action()
*/
public MyCustomPostAction() {
super();
}
/* (non-Java-doc)
* @see com.liferay.portal.kernel.events.Action#run(HttpServletRequest request, HttpServletResponse response)
*/
public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException {
long companyId = PortalUtil.getCompanyId(request);
String path = null;
try {
path = PrefsPropsUtil.getString(
companyId, PropsKeys.DEFAULT_LANDING_PAGE_PATH);
System.out.println("I am doing something..");
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (_log.isInfoEnabled()) {
_log.info(
PropsKeys.DEFAULT_LANDING_PAGE_PATH + StringPool.EQUAL + path);
}
if (Validator.isNotNull(path)) {
LastPath lastPath = new LastPath(StringPool.BLANK, path);
HttpSession session = request.getSession();
session.setAttribute(WebKeys.LAST_PATH, lastPath);
}
}
private static Log _log = LogFactoryUtil.getLog(
MyCustomPostAction.class);
}
Ravi Kumar Gupta, modificado hace 12 años.
RE: DefaultLandingPageAction Hook - class not found Exception
Liferay Legend Mensajes: 1302 Fecha de incorporación: 24/06/09 Mensajes recientes
And yes,
By default when I copied the content eclipse imported classes from portal-impl for which I got the error while compiling.. I had to modify the imports and its working fine now.. consider deleting temp, work folders..
By default when I copied the content eclipse imported classes from portal-impl for which I got the error while compiling.. I had to modify the imports and its working fine now.. consider deleting temp, work folders..
pspyra pspyra, modificado hace 10 años.
RE: DefaultLandingPageAction Hook - class not found Exception
New Member Mensajes: 6 Fecha de incorporación: 31/07/13 Mensajes recientes
Hey,
I'm using liferay 6.1.1-ce-ga2 bundled with Tomcat 7.0.27.
I've got similar problem, but in my case the error points to com.liferay.portal.util.OpenIdUtil class.
java.lang.NoClassDefFoundError: com/liferay/portal/util/OpenIdUtil
I'm trying to override the com.liferay.portlet.login.action.OpenIdAction as it's described here:
https://www.liferay.com/web/mika.koivisto/blog/-/blogs/overriding-and-adding-struts-actions-from-hook-plugins
For the test purpose I just copied all protected methods from the liferay's source code of OpenIdAction.java and put them to my class which extends BaseStrutsPortletAction.
I put the break point in sendOpenIdRequest method and the exception (java.lang.NoClassDefFoundError: com/liferay/portal/util/OpenIdUtil) is thrown when the java tries to invoke this line:
When I comment this line, then liferay throws the exception
during execution of this line
The problem does not arise during the deployment, only in run time, when I try to login with OpenId.
I want to override OpenIdAction, because I need to add some extra openId attributes (by default liferay asks only for email, firstName and lastName).
Is it possible to override this action or do I have to write ext-plugin, which I'm extremly trying to avoid.
I'm using liferay 6.1.1-ce-ga2 bundled with Tomcat 7.0.27.
I've got similar problem, but in my case the error points to com.liferay.portal.util.OpenIdUtil class.
java.lang.NoClassDefFoundError: com/liferay/portal/util/OpenIdUtil
I'm trying to override the com.liferay.portlet.login.action.OpenIdAction as it's described here:
https://www.liferay.com/web/mika.koivisto/blog/-/blogs/overriding-and-adding-struts-actions-from-hook-plugins
For the test purpose I just copied all protected methods from the liferay's source code of OpenIdAction.java and put them to my class which extends BaseStrutsPortletAction.
I put the break point in sendOpenIdRequest method and the exception (java.lang.NoClassDefFoundError: com/liferay/portal/util/OpenIdUtil) is thrown when the java tries to invoke this line:
if (!OpenIdUtil.isEnabled(themeDisplay.getCompanyId()))
When I comment this line, then liferay throws the exception
java.lang.NoClassDefFoundError: com/liferay/portlet/ActionResponseImpl
during execution of this line
ActionResponseImpl actionResponseImpl = (ActionResponseImpl)actionResponse;
The problem does not arise during the deployment, only in run time, when I try to login with OpenId.
I want to override OpenIdAction, because I need to add some extra openId attributes (by default liferay asks only for email, firstName and lastName).
Is it possible to override this action or do I have to write ext-plugin, which I'm extremly trying to avoid.
Mika Koivisto, modificado hace 10 años.
RE: DefaultLandingPageAction Hook - class not found Exception
Liferay Legend Mensajes: 1519 Fecha de incorporación: 7/08/06 Mensajes recientes
You are trying to use classes that are not available to plugins. That is why you are getting those NoClassDefFoundErrors.