Fórumok

problems in building struts action portlet in Plugins SDK environment

li guicheng, módosítva 13 év-val korábban

problems in building struts action portlet in Plugins SDK environment

Junior Member Bejegyzések: 25 Csatlakozás dátuma: 2010.03.29. Legújabb bejegyzések
Hi, all
I'm building a struts action portlet in Plugins SDK environment and have some problems.
The Plugins SDK build command " create newportlet "My New Portlet" " is to create a JSP portlet. this wiki: http://www.liferay.com/community/wiki/-/wiki/Main/Struts+Action+Portlet+in+Plugin+SDK tells how to change it to be a struts action portlet.
So I follow the steps and deploy the portlet.but the portlet cannot be seen. The errors are:

03:08:19,109 INFO  [PortletHotDeployListener:227] Registering portlets for Footer-portlet
03:08:19,171 ERROR [PortletHotDeployListener:663] java.lang.ClassCastException: com.liferay.portlet.PortletConfigImpl cannot be cast to com.liferay.portlet.PortletConfigImpl
java.lang.ClassCastException: com.liferay.portlet.PortletConfigImpl cannot be cast to com.liferay.portlet.PortletConfigImpl
	at com.liferay.portlet.StrutsPortlet.init(StrutsPortlet.java:175)
	at com.liferay.portlet.InvokerPortletImpl.init(InvokerPortletImpl.java:250)
	at com.liferay.portlet.PortletInstanceFactoryImpl.init(PortletInstanceFactoryImpl.java:245)
	at com.liferay.portlet.PortletInstanceFactoryImpl.create(PortletInstanceFactoryImpl.java:135)
	at com.liferay.portlet.PortletInstanceFactoryUtil.create(PortletInstanceFactoryUtil.java:47)
	at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortlet(PortletHotDeployListener.java:660)
	at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:250)
	at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:127)
	at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:108)
	at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:153)
	at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:43)
	at com.liferay.portal.kernel.servlet.PortletContextListener.portalInit(PortletContextListener.java:113)
	at com.liferay.portal.kernel.util.PortalInitableUtil.init(PortalInitableUtil.java:48)
	at com.liferay.portal.kernel.servlet.PortletContextListener.contextInitialized(PortletContextListener.java:109)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1217)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
	at java.lang.Thread.run(Unknown Source)
03:08:19,187 INFO  [PortletHotDeployListener:346] 1 portlet for Footer-portlet is available for use
03:08:19,953 INFO  [TilesPlugin:236] Tiles definition factory loaded for module ''.
Loading jar:file:/E:/workspace_ganymede/LiferayPortal/tomcat-6.0.18/webapps/Footer-portlet/WEB-INF/lib/portal-impl.jar!/portal.properties
Loading file:/E:/workspace_ganymede/LiferayPortal/tomcat-6.0.18/webapps/ROOT/WEB-INF/classes/portal-ext.properties
03:08:20,000 INFO  [TilesRequestProcessor:103] Tiles definition factory found for request processor ''.
03:08:49,656 INFO  [PluginPackageUtil:1153] Reloading repositories


anybody can give me some hints?

thanks in advance.

li guicheng
thumbnail
Tina Agrawal, módosítva 13 év-val korábban

RE: problems in building struts action portlet in Plugins SDK environment

Expert Bejegyzések: 297 Csatlakozás dátuma: 2008.01.03. Legújabb bejegyzések
May be you can give the community struts portlet to start with.
Modify it to support your needs - Sample Struts Portlet

Regards,
Tina
li guicheng, módosítva 13 év-val korábban

RE: problems in building struts action portlet in Plugins SDK environment

Junior Member Bejegyzések: 25 Csatlakozás dátuma: 2010.03.29. Legújabb bejegyzések
Hi, Tina

Thanks for reply.

The sample portlet is great. But I have another problem in creating a render action.
Error:

org.apache.struts.tiles.NoSuchDefinitionException: Error while resolving definition inheritance: child 'portlet.footer_portlet.test' can't find its ancestor 'portlet.footer_portlet'. Please check your description file.

--------
view.jsp

<a href="<portlet:renderURL windowState=" <%="WindowState.MAXIMIZED.toString()" %>"&gt;<portlet:param name="struts_action" value="/footer_portlet/test" />"&gt;Go to test</a>

--------
struts-config.xml

<action path="/footer_portlet/test" forward="portlet.footer_portlet.test"></action>

--------
tiles-defs.xml

<definition name="portlet.footer_portlet.test" extends="portlet.footer_portlet">
		<put name="portlet_content" value="/html/portlet/footer_portlet/test.jsp"></put>
</definition>


What's the extends atrribute in the tab difinition? And Where to define it?

thanks again.

li guicheng
li guicheng, módosítva 13 év-val korábban

RE: problems in building struts action portlet in Plugins SDK environment

Junior Member Bejegyzések: 25 Csatlakozás dátuma: 2010.03.29. Legújabb bejegyzések
Hi,

I just find the book that explains it: (page 105)
"What are portlet.ext.book_reports.view and portlet.ext.book_reports.view_reports in the code above? They are the forwards. What is portlet? The portlet is the template that will be used (that is, /common/themes/portlet.jsp, refer to the XML file /portal/portal-web/docroot/WEB-INF/tiles-defs.xml). Why is the path starting from /portlet, and not from /html, even though the directory structure is /docroot/html/portlet? It's because the /html part already added the /portal/portal-web/docroot/html/common/themes/portlet.jsp file. In general, there are two pages: view.jsp and view_reports.jsp."

So it is the definition name of the template page. Just as the sample portlet has a template.jsp and in the tiles-defs.xml has a definition

<definition name="portlet.sample_struts_portlet" path="/html/portlet/sample_struts_portlet/template.jsp" />



thanks

li guicheng