David Botterill's Weblog

« Previous day (Jun 22, 2006) | Main | Next day (Jun 24, 2006) »

20060623 Friday June 23, 2006

Java Studio Creator 2 Portlets and Jetspeed-2

I finally had time to get a Java Studio Creator 2 Update 1 portlet working on Apache Jetspeed-2.  You have to make a couple of modifications to the Creator portlet project to get things working properly.

Modification 1 - Remove the "tld" Folder

If you don't remove the "tld" folder from the Creator-produced WAR, you'll get the following exception in the Jetspeed-2 log during the deploy.

Attempting to add portlet.tld to war...
Adding portlet.tld to war...
ERROR: java.util.zip.ZipException: duplicate entry: WEB-INF/tld/portlet.tld
org.apache.jetspeed.deployment.DeploymentException: java.util.zip.ZipException:
duplicate entry: WEB-INF/tld/portlet.tld at org.apache.jetspeed.deployment.impl.DeployPortletAppEventListener.deployPortletApplication(DeployPortletAppEventListener.java:173)
        at org.apache.jetspeed.deployment.impl.DeployPortletAppEventListener.invokeDeploy(DeployPortletAppEventListener.java:158)
        at org.apache.jetspeed.deployment.impl.StandardDeploymentManager.dispatch(StandardDeploymentManager.java:257)
        at org.apache.jetspeed.deployment.impl.StandardDeploymentManager.deploy(StandardDeploymentManager.java:168)
        at org.apache.jetspeed.deployment.impl.StandardDeploymentManager.fireDeploymentEvent(StandardDeploymentManager.java:202)
        at org.apache.jetspeed.deployment.impl.StandardDeploymentManager$FileSystemScanner.run(StandardDeploymentManager.java:342)
Caused by: java.util.zip.ZipException: duplicate entry: WEB-INF/tld/portlet.tld
        at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:163)
        at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:90)
        at org.apache.jetspeed.tools.deploy.JetspeedDeploy.addFile(JetspeedDeploy.java:277)
        at org.apache.jetspeed.tools.deploy.JetspeedDeploy.<init>(JetspeedDeploy.java:170)
        at org.apache.jetspeed.deployment.impl.DeployPortletAppEventListener.deployPortletApplication(DeployPortletAppEventListener.java:168)
        ... 5 more
ERROR: Failure deploying C:\Apache Jetspeed 2.0\webapps\jetspeed\WEB-INF\deploy\
Portlet3.war


First you'll need to remove the "tld" folder from the Creator project because the Jetspeed-2 deployment process injects a "tld" folder.

Go to the "Files" window, select the "tld" folder, right-click and select "Delete".

delete tld folder


Modification 2 - Remove the "portlet.jar" from the Run Time Library

Next, you'll need to remove "portlet.jar" file from the "Sun Web UI Components" library.  If this is not removed, you'll get a "ClassCastException" because the JetSpeed-2 container, in the classloader hierarchy, already has a "portlet.jar" and specifically the "Portlet" interface.

Open the Library manager by selecting the "Tools->Library Manager" menu.  Select the "Sun Web UI Components"  library on the left.  You should see something like this.

library manager

Remove the "jar:nbinst:///modules/ext/portlet.jar" entry and press the "OK" button.

Next, export the WAR file by doing a right-click on the Project node and choosing "Export War...".  Choose the 1.4 J2EE container and make the target directory the "jetspeed-2_installdir/webapps/jetspeed/WEB-INF/deploy" directory.  When the WAR file is place here, Jetspeed-2 will pick up the WAR file and deploy it to the app server and to the portal server.  Then you'll need to add it to a page by editing the appropriate ".psml" file as directed in the Jetspeed-2  manual.  I chose to put mine in the "jsf-demo.psml" file so the portlet would show up with the other JSF portlets.

Working Proof

Here's a screen shot just so you believe me. :)

proof
Posted by david ( Jun 23 2006, 06:40:38 PM MDT ) Permalink Comments [16] del.icio.us | digg | technorati