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
Comments:

I am wonder how it possible track changes of locale in what case simple: FacesContext context = FacesContext.getCurrentInstance(); locale = context.getViewRoot().getLocale(); Don't help couse it keep first loaded Locale all time

Posted by alex on July 12, 2006 at 01:11 AM MDT #

I am wonder how it possible track changes of locale in what case simple: FacesContext context = FacesContext.getCurrentInstance(); locale = context.getViewRoot().getLocale(); Don't help couse it keep first loaded Locale all time

Posted by alex on July 12, 2006 at 01:11 AM MDT #

Following your instructions, all I see in Jetspeed is "Cannot create Portlet instance com.sun.faces.portlet.FacesPortlet for Portlet Application PortletB".

Are there no other changes that need to be made?

I've been down several paths that start with making "org.apache.portals.bridges.jsf.FacesPortlet" the portlet-class, but still no success.

Any help would be appreciated.

Posted by Brian on August 14, 2006 at 02:42 AM MDT #

Brian,
Please look at the app server log to see if there are any exceptions. Also, please look for some common solutions on the Java Studio Creator Forum at http://forum.sun.com/jive/thread.jspa?forumID=123.
Thanks!
-David

Posted by David Botterill on August 15, 2006 at 05:26 PM MDT #

Alex,
I don't have a lot of experience with locale switching and JSF. I suggest you check the JSF forum at http://forum.java.sun.com/forum.jspa?forumID=427 or the Sun Portal Server forums at http://swforum.java.sun.com/jive/category.jspa?categoryID=2.
Thanks!
-David

Posted by David Botterill on August 15, 2006 at 05:39 PM MDT #

Great ! Thanks much ! Creator is great ;-))

Posted by Nicolas on September 13, 2006 at 12:43 AM MDT #

Hi, Can we use Hibernate with JetSpeed-2? I have been trying to use it but giving me many errors. Anyway.. if you have already used it, please send me the code. Thanks. regards, Anand

Posted by Anand Kulkarni on October 24, 2006 at 11:23 PM MDT #

I don't see why not. Please look to the Jetspeed-2 help information for answers on this at http://portals.apache.org/jetspeed-2/how-to-help.html.
Thanks!
-David

Posted by David Botterill on October 25, 2006 at 09:53 AM MDT #

hi david! I would be obliged if u give me some information on how to develop and deploy a sample portlet in jetspeed 2.0. Anticipating a reply, Thanks, Pavan

Posted by pavan on November 20, 2006 at 03:34 PM MST #

Pavan,
Besides the information I've provided in this blog and the Creator/Jetspeed-2 documentation, there really isn't any more to offer. Please provide specifics about any problems you might be having.
Thanks!
-David

Posted by David Botterill on November 21, 2006 at 02:50 AM MST #

hi david! First of all thanks to replying to my comment. I developed a sample application in portlets in myeclipse. when i deploy the application, it is getting deployed successfully and when i change the default-page.psml by pasting info. regarding my portlet it is showing error in the server as "error 1.1: prolog cannot be changed". when i try to access my own .psml file it is showing the original default-page.psml. my psml file is not reflecting there. pls solve the problem. thanks and regards, pavan

Posted by pavan on November 21, 2006 at 11:13 PM MST #

Pavan,
I'm actually a Java Tools Evangelist so I don't have any information about portlets developed with myeclipse. Your problem does appear to be something to do with the Jetspeed-2 specifically though so I would refer to http://portals.apache.org/jetspeed-2/ for information.
Or you could develop the portlets in Java Studio Creator and this blog plus a large community of portlet developers would be able to help. :)
-David

Posted by David Botterill on November 22, 2006 at 08:04 AM MST #

Following your instructions, all I see in Jetspeed is "Cannot create Portlet instance com.sun.faces.portlet.FacesPortlet for Portlet Application PortletB". Are there no other changes that need to be made? I've been down several paths that start with making "org.apache.portals.bridges.jsf.FacesPortlet" the portlet-class, but still no success. Any help would be appreciated.

Posted by Brian on February 01, 2007 at 08:08 AM MST #

Hello Sir You wrote: 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. Which is the appropriate file .psml?? Do I have to create it? Could You give a link to this procedure because I can not manage with it

Posted by Marcin Migdal on February 01, 2007 at 08:08 AM MST #

hi, If it's possible I wanted your email adr. I have a problem that really confused me. your help will be greatly appreciated because I am out of any idea how to solve my problem :'( I am waiting for your answer. -Thanks in advance....

Posted by Farhadi on July 10, 2007 at 08:11 AM MDT #

did u happen to come accross this case when running a portlet developed with Sun Creator 2 U 1 studio on Jetspeed-2;
I did exactly what you did, and this is what i got in the jetspeed-2 demo logs:
(supposing my portlet is AnotherPortlet.war)

INFO: Deploying web application archive AnotherPortlet.war
Nov 14, 2007 12:25:29 PM org.apache.commons.beanutils.MethodUtils getMatchingAccessibleMethod WARNING: Cannot use JVM pre-1.4 access bug workaround die to restrictive security manager.
Nov 14, 2007 12:25:29 PM com.sun.faces.config.rules.ComponentRule end
WARNING: [ComponentRule]{faces-config/component} Merge(com.sun.rave.web.ui.Time)
Nov 14, 2007 12:25:29 PM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(null,java.math.BigDecimal)
Nov 14, 2007 12:25:29 PM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(null,java.math.BigInteger)
Nov 14, 2007 12:25:32 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Nov 14, 2007 12:25:32 PM org.apache.catalina.core.StandardContext start

& hence, the portlet didnot appear on the page, instead a text appeared in its location saying it couldnt been started

Thx in advance

Posted by nasimjo on November 13, 2007 at 10:43 PM MST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

David Botterill

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today