掲示板
DefaultLandingPageAction Hook - class not found Exception
12年前 に Gnaniyar Zubair によって更新されました。
DefaultLandingPageAction Hook - class not found Exception
Liferay Master 投稿: 722 参加年月日: 07/12/19 最新の投稿
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
12年前 に Ravi Kumar Gupta によって更新されました。
RE: DefaultLandingPageAction Hook - class not found Exception
Liferay Legend 投稿: 1302 参加年月日: 09/06/24 最新の投稿
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);
}
12年前 に Ravi Kumar Gupta によって更新されました。
RE: DefaultLandingPageAction Hook - class not found Exception
Liferay Legend 投稿: 1302 参加年月日: 09/06/24 最新の投稿
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..
10年前 に pspyra pspyra によって更新されました。
RE: DefaultLandingPageAction Hook - class not found Exception
New Member 投稿: 6 参加年月日: 13/07/31 最新の投稿
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.
10年前 に Mika Koivisto によって更新されました。
RE: DefaultLandingPageAction Hook - class not found Exception
Liferay Legend 投稿: 1519 参加年月日: 06/08/07 最新の投稿
You are trying to use classes that are not available to plugins. That is why you are getting those NoClassDefFoundErrors.