掲示板

Caused by: java.lang.ClassCastException: cannot be cast to javax.portlet.P

12年前 に Ravi Kiran によって更新されました。

Caused by: java.lang.ClassCastException: cannot be cast to javax.portlet.P

Junior Member 投稿: 98 参加年月日: 11/12/12 最新の投稿
Hi ,

I have created a Struts2 Portlet this way :

package com.robisoft.portlet.struts.action;

import org.apache.struts2.dispatcher.DefaultActionSupport;

import com.opensymphony.xwork2.ActionSupport;

public class Struts2Action extends DefaultActionSupport {
String name = null;

@Override
public String execute() throws Exception {
// Enter business logic here
return ActionSupport.SUCCESS;
}

public void validate() {
if ((name == null) || (name.length() == 0))
addFieldError("name", "Name is required!");
}

public void setName(String name) {
this.name = name;
}

public String getName() {
return name;
}

}



And my portlet.xml looks this way

<portlet>
<portlet-name>struts2action</portlet-name>
<display-name>Struts2Action</display-name>
<portlet-class>
com.robisoft.portlet.struts.action.Struts2Action
</portlet-class>
<init-param>
<name>view-jsp</name>
<value>/view/view.jsp</value>
</init-param>









05:06:28,578 ERROR [HotDeployUtil:114] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for HelloStruts2-portlet
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for HelloStruts2-portlet
at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:117)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:111)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:188)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:40)
at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit(PortletContextListener.java:101)
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:53)
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:4723)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException: com.robisoft.portlet.struts.action.Struts2Action cannot be cast to javax.portlet.Portlet
at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:131)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortlet(PortletHotDeployListener.java:603)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:385)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:114)













When i googled for this error it suggests about removal of portlet.jar , when i did so inside which is present inside
E:\liferaytomcat\liferay-portal-6.1.0-ce-b4\tomcat-7.0.22\lib\ext , it popped up with several erorors and the listener itself didn't start
... 17 more
thumbnail
12年前 に jelmer kuperus によって更新されました。

RE: Caused by: java.lang.ClassCastException: cannot be cast to javax.portl

Liferay Legend 投稿: 1191 参加年月日: 10/03/10 最新の投稿
Actions are not portlets you dhould use and configure org.apache.struts2.portlet.dispatcher.Jsr286Dispatcher in your portlet.xml
12年前 に Ravi Kiran によって更新されました。

RE: Caused by: java.lang.ClassCastException: cannot be cast to javax.portl

Junior Member 投稿: 98 参加年月日: 11/12/12 最新の投稿
Thank you very much .
10年前 に asif aftab によって更新されました。

RE: Caused by: java.lang.ClassCastException: cannot be cast to javax.portl

Regular Member 投稿: 123 参加年月日: 13/09/02 最新の投稿
is your problem then please help me I am trying to overriding pre and post login event and I am getting the same error. Same procedure I used to create a hook in startup service event in which I created custom attributes by using hook. This one is working perfectly but this time I am getting error.