Monthly Archives: August 2007

Deploying A Portlet to Jetspeed 2

This page exists primarily as a note to self regarding deployment of Portlets to a development version of Jetspeed.

The key is simple. 

When deploying a webapp to Jetspeed you need to put it into ${TOMCAT_HOME}/webapps/jetspeed/WEB-INF/deploy/. This information is available in the article on Jetspeed-2 Deploy tools jetspeed site, which (when I looked) wasn't on the google search for jetspeed deployment, which is instead littered with many references to maven (which still ranks as one of the most disappointing open source projects in my mind).

Knowing this information is important because (for someone who has experience in hacking with webapps), it is tempting to just drop a war into ${TOMCAT_HOME}/webapps and assume that things will just work.  This really doesn't work, and gives errors like:

"Title Error: Cannot pass a null PortletDefinition to a PortletEntity" 

Unfortunately (again at time of develpment) google didn't really make it clear that this error can be caused by the fact that Jetspeed can't load your class.

After getting the portlet deployed, you'll also want to hack up a psml file and put it in ${TOMCAT_HOME}/webapps/jetspeed/WEB-INF/pages.  

Something like this forms a half decent starting point.

<page id="simple"
    xmlns="http://portals.apache.org/jetspeed"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://portals.apache.org/jetspeed http://portals.apache.org/jetspeed-2/2.1/schemas/psml.xsd">

    <defaults skin="orange" layout-decorator="tigris" portlet-decorator="tigris"/>
    <title>This is the simplest portlet in the world</title>
    <metadata name="title" xml:lang="fr">La plus simple portlet du monde</metadata>

    <fragment id="simplest" type="layout" name="jetspeed-layouts::VelocityTwoColumns">
        <fragment id="simplest-first" type="portlet" name="E2::PortletWrapper">
            <property layout="TwoColumns" name="row" value="0" />
            <property layout="TwoColumns" name="column" value="0" />
        </fragment>
    </fragment>

    <security-constraints>
        <security-constraints-ref>public-view</security-constraints-ref>
    </security-constraints>
</page>

Of course if you want you can use various jetspeed tools to try and make this bit easier, but for the old skool guys who want to be in control, this is a pretty decent option.