views:

28

answers:

1

Hello,

I am running a jetspeed portal which contains various portlet applications and have come across an issue after a recent reinstall where some of the portlets will return

Cannot pass a null PortletDefinition to a PortletEntity

Any idea what is causing this issue? I investigated a bit and it seems that jetspeed runs a process when new portlets are added where it creates mappings in its DB (derby in my case). If this does not complete it seems to cause this problem. Is my assumption correct? If yes, how can I restart this process?

Many thanks

+1  A: 

This exception can be caused by having a mismatched portlet name on on your page. This often happens when the portlet application is deployed with one name, but then the page fragment references another name, for example, on your page you have:

<fragment id="1234" type="portlet" name="myApp::myPortlet">

and when you deploy your war file, it is named for example myApp-1.0-SNAPSHOT.war

The fragment's name attribute should have the value "${portlet.war.name}::${portlet.name}. The first part (${portlet.war.name}) is the name of the portlet war file, minus the .war. The second part comes from the value of the tag in the portlet.xml file.

You can either rename your war file, or change your page definition to include the version. I don't recommend putting the version number in the fragment though, as it can change.

A third solution is to actually change the name of the portlet app in your web.xml by setting an init param named contextName on the Jetspeed Container servlet. In the example below its set to "myApp":

<servlet>
    <description>MVC Servlet for Jetspeed Portlet Applications</description>
    <display-name>Jetspeed Container</display-name>
    <servlet-name>JetspeedContainer</servlet-name>
    <servlet-class>
      org.apache.jetspeed.container.JetspeedContainerServlet</servlet-class>
     <init-param>
      <param-name>contextName</param-name>
      <param-value>myApp</param-value>
    </init-param>
    <load-on-startup>100</load-on-startup>
  </servlet>