以下是我在具体配置和开发中遇到的问题和解决的办法。
注意:这里的Solution是根据我的开发环境和项目给出的,并不一定适合你的项目,需要具体问题具体分析。
另外,还有一些问题没有找到Reason,只是有个Solution,有知道Root Cause的高手,麻烦指导一二,THX
Problems and Solution
1)portletentityregistry.xml
It contains the definition of the portlet. Add these lines to it:
<application id="5">
<definition-id>HelloWorld</definition-id>
<portlet id="1">
<definition-id>HelloWorld.HelloWorld</definition-id>
</portlet>
</application>
The <definition-id> of the application should be the name of the web application folder. The portlet's <definition-id> should be equal to the generated portlet-guid in web.xml.
2)web.xml
<init-param>
<param-name>portlet-guid</param-name>
<param-value>HelloPortal.HelloWorldPortlet</param-value>
</init-param>
The <portlet-guid> of the servlet should be <folder name in webapps of Tomcat>.<portlet name in portlet.xml>
3)Encounter Eceptions
javax.servlet.UnavailableException: Initialization of one or more services failed
>>>>>>need to find out the Root Cause
change the <portlet-app> in portlet.xml of the project.
Right
<portlet-app
xmlns="/org/apache/pluto/portalImpl/xml/portlet-app_1_0.xsd"
version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="/org/apache/pluto/portalImpl/xml/portlet-app_1_0.xsd /org/apache/pluto/portalImpl/xml/portlet-app_1_0.xsd">
Wrong
<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
java.lang.IllegalStateException: The prepare method was never called
JDK issue. After I change the JDK to 1.4, it is OK.
ERROR org.apache.pluto.invoker PortletInvokerImpl.render() - Error while dispatching portlet.
java.lang.IllegalStateException: The prepare method was never called
at org.apache.pluto.PortletContainerServices.get(PortletContainerServices.java:38)
at org.apache.pluto.services.information.InformationProviderAccess.getContainerService(InformationProviderAccess.java:39)
at org.apache.pluto.services.information.InformationProviderAccess.getStaticProvider(InformationProviderAccess.java:29)
at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:86)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:880)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:613)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:597)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:519)
......