Build JSF Portlet with NetBeans Visual Web Pack and NetBeans Portal Pack

Posted: July 25, 2007 in NetBeans

In this blog I will explain how  NetBeans 6.0 M10 with Visual Web Pack and Portal Pack 2.0 preview plug-in can be used to develop & deploy JSF Portlet application.

NetBeans Portal Pack : As a plug-in for NetBeans IDE, it provides supports to create JSR-168 portlet. It also supports deployment of portlets on OpenPortal Portlet Container & OpenPortal Portal Server from NetBeans IDE.

NetBeans Visual Web Pack : Using Visual Web Pack user can Drag and drop JavaServer Faces components and design JSF based web application. But currently there is no support for portlet application.

Sun Java Studio Creator 2 : It provides all the functionalities of Visual Web Pack . Also it provides supports for JSF portlet creation through drag and drop of  JSF components.

In future NetBeans Visual Web Pack will be the full replacement for Sun Java Studio Creator and everything supported by Sun Java Studio Creator will be supported by NetBeans with Visual Web Pack.

Currently the JSF Portlet Builder capability is missing in the current version of Visual Web Pack. So for last few days I was trying to make NetBeans Portal Pack and Visual Web Pack working together and provide JSF Portlet Builder functionality through Visual Web Pack and deployment functionalities through NetBeans Portal Pack. Finally I found some manual steps to achieve this functionality and believe me it’s worth following those workarounds.

Installation and Configuration Steps :

  1. Download and Install NetBeans 6.0 M10 with Visual Web Pack
  2. Download and Install NetBeans Portal Pack 2.0 preview for NetBeans 6.0 M10 .
  3. Follow the instructions given in http://blogs.sun.com/satya/entry/easy_steps_to_set_up   to setup GlassFish Application Server & OpenPortal Portlet Container. No need to install GlassFish App Server separately if you have already installed it during NetBeans IDE installation.
  4. To know how to configure OpenPortal Portlet Container in your NetBeans IDE go through this user guide.
  5. Add Javaee.jar to your run time server instance classpath in NetBeans IDE . This is a one time process which is required for compilation of jsf portlet projects.(But this step will not be required in the future version of the Portal Pack and javaee.jar will be added automatically.) To do this
  • Go to Services > Servers
  • Right click on the "OpenPortal Portlet Container" instance
  • Server Config dialog box opens
  • Click on "Classes" tab for OpenPortal Portlet Container .
  • Add Javaee.jar which can be found at glassfish_home/lib/javaee.jar .
  • Press "Apply" button to save this change
  • Please restart the NetBeans IDE to make sure that server instance classpath is refreshed

Steps To Create JSF Portlet Application :

  • Create a New Web Project. Select "Visual Web JavaServer Faces" framework during project creation to create a JSF based web application. Don’t select "Portlet Support" framework during project creation.
  • After the project is created, add "Portlet Support" framework to that project. To do that
    • Right click on the project node
    • Click on Properties > Frameworks
    • Click Add to add "Portlet Support" framework to this web application.
  • Now configure your project to package jsf-portlet.jar into the final war file. Don’t add this jar to the project’s library or classpath. To set the packaging option
    • Right click on the project node
    • Click on Properties
    • Select "Packaging" under "Build" node.
    • Press "Add File/Folder" button
    • Select downloaded jsf-portlet.jar . Enter "Path In War"  as "WEB-INF/lib" to package and make this jar available during runtime of  this web application.
  • Open web.xml and comment out the following <init-param> section in the  FacesServlet declaration.

                   <init-param>
                                <param-name>javax.faces.LIFECYCLE_ID</param-name>
                                <param-value>com.sun.faces.lifecycle.PARTIAL</param-value>
                   </init-param>

  • Notice by default there is a Page1.jsp file created inside that web application.
  • Now open portlet.xml created under WEB-INF folder. Add following xml elemet to your portlet.xml

<portlet>
        <description>JSF Sample Portlet</description>
        <portlet-name>jsfsampleportlet</portlet-name>
        <display-name>JSF Sample Portlet</display-name>
        <portlet-class>com.sun.faces.portlet.FacesPortlet</portlet-class>
        <init-param>
              <description>Portlet init view page</description>
              <name>com.sun.faces.portlet.INIT_VIEW</name>
              <value>/Page1.jsp</value>
        </init-param>
        <supports>
              <mime-type>text/html</mime-type>
              <portlet-mode>VIEW</portlet-mode>
              <portlet-mode>EDIT</portlet-mode>
              <portlet-mode>HELP</portlet-mode>
        </supports>
        <portlet-info>
              <title>JSF Sample Portlet</title>
              <short-title>jsfsampleportlet</short-title>
        </portlet-info>
  </portlet>

   Note that Portlet INIT_VIEW page is set as Page1.jsp . You can set it to any custom page if you want
. Now your deployment descriptor is ready for deployment.

  • Now double click on the Page1.jsp to open the jsf visual editor for this jsp.
  • Go to "JSP" mode in that visual editor which shows the code for the jsp.
  • Add <div style="-rave-layout: grid; position: relative; height: 400px;">  element just after <f:view> element as an sub-element of <f:view> . Make sure to end that </div> just before </f:view> in the end. So the JSP code will look like something below. This is required to make sure that all markup of jsp page will be shown inside that portlet window and ignore any absolute location.

                          …….  

                         <f:view>
                            <div style="-rave-layout: grid; position: relative; height: 400px;">
                            <webuijsf:page binding="#{Page1.page1}" id="page1">

                            …..

  • Add <webuijsf:themeLinks ajaxify="false" id="theme_1"/> element just after <webuijsf:body> element  but before <webuijsf:form> element as an sub-element of <webuijsf:body> . This  ThemeLinks component is used to create references to theme resources on
    a page in a portlet environment, where the Head component cannot be used. After this change the JSP code will look like below

                ……
                <webuijsf:body binding="#{Page1.body1}" id="body1" style="-rave-layout: grid">
                        <webuijsf:themeLinks ajaxify="false" id="theme_1"/>
                        <webuijsf:form binding="#{Page1.form1}" id="form1">

                …….

  • Now save that JSP
  • Go to "Design" view
  • Open the Palette for this JSF designer and drag and drop components to the designer to design your JSF page.
  • After you done, save your JSP

To Deploy the Application

  • Select the target run time for this web application as an instance of "OpenPortal Portlet Container"
  • Then right click on the project select "Undeploy and Deploy" to deploy this application as portlet application on OpenPortal Portlet Container.

I usually hate long blogs 🙂 So I am summarizing above contents

  • Download, install and configure all required components
  • Add javaee.jar to server instance classpath which is required for compilation.
  • Create a Visual Web Application
  • Add "Portlet Support" framework
  • Add jsfportlet.jar for packaging
  • Comment out the <init-param> section for FacesServlet in web.xml
  • Add jsf portlet entry to the portlet.xml
  • Add <div> and <webuijsf:themeLinks> tag to jsp code
  • Design using drap & drop support
  • Deploy your application to portlet container.

In case any issue, please leave a comment.

 

Advertisements
Comments
  1. Roman Rubio says:

    Hey Satya, thanks for the tutorial, some time ago, i can´t find a good example like this. Thanks. BTW, your href of the image it´s broken.

  2. Viggo Navarsete says:

    I really enjoyed this blog post, as I have had problems using the visual web pack with JSF portlets myself.
    I see that you set the flag ajaxify to false, what does it mean?
    Will you do a follow-up on how to use jMaki or other “native” ajax-libraries in a JSF portlet?
    Keep up the good work!!!

  3. Satya Ranjan says:

    Thanks Roman & Viggo for your comments.
    Viggo, the ajaxify flag in <webuijsf:themeLinks> is not required. I just tried without ajaxify flag and it worked. As you suggested I will follow up with jMaki library in a JSF Portlet.

  4. Satya Ranjan says:

    I tried above steps with NetBeans 5.5.1 Visual Web Pack and Portal Pack 1.3 Beta Plug-in and it worked without any problem.
    Few changes in the steps are
    – Create a Visual Web Application, then add portlet.xml with above mentioned entries manually.
    – No need to change web.xml

  5. Viggo Navarsete says:

    Sataya, I have a problem I might think you have a solution for. I have a JSF portlet with a backing bean which retrives information when I push a “Search” button, which is linked to the “search” method in my backing bean. In my JSP I have a tree (http://developer.yahoo.com/yui/treeview/) I want to populate with the data retrieved from the “search” method.
    I’m not sure how to get the data from my search method in my backing bean back to the client, where I need a javascript to generate the tree structure for me. Do you have any input?

  6. murali says:

    Hi Viggo,
    I did similar kind of stuff some time back.I suggest that instead of using yahoo tree use Jmaki which is wrapper over all the javascript libraries.So when you use jmaki you can use either yahoo tree or dojo tree and get the same behaviour.
    In this case your backing bean will have a variable say NodeValue then you will have two methods in that getNodeValue and setNodeValue right.So in the jsp page where you want to display the tree use this jmaki widget and get the value by using
    YourBeanName.NodeValue in this case.And then you are done.
    Pasting a sample of how the jsp code will look like.
    <a:widget name=”dojo.tree”
    value=”<%=nodes%>”/>
    for your notice Jmaki is very well integrated with netbeans you can just add Jmaki plugin.

  7. Sandeep Soni says:

    When pressing search on your portlet page, you r page will refresh and the “search” method on your bean will be called. At this point on the server side, you can fetch the search results, place the results in some format ( say XML) and put this value in a javascript variable.
    Then on the client side, you have to register a callback method to read this XML variable iterate through it and then repopulate the nodes of the tree. [ The dynamic loading feature of the tree is what you will have use : http://developer.yahoo.com/yui/treeview/#dynamicloading%5D

  8. Viggo Navarsete says:

    Thanks murali and Sandeep:)

    murall: I’m looking for the “specialized” version of a tree with checkboxes next to each node in the tree, like this one: http://developer.yahoo.com/yui/examples/treeview/check.html
    That’s the reason I had to go for the “native” yahoo javascript library. Of course I could perhaps extend the jMaki datamodel and add some events to it, but I don’t have time to do so at the moment I think. ( I really like the jMaki initative, and hopefully I will be able to give the “checkbox-tree” back to the community some day..)

    Sandeep: A couple of follow-up questions if you have time:

    1. “..and put this value in a javascript variable”. Could you provide an example of how I could do this from my backing bean?

    2. To give an example of how I _think_ it would work on the client side:

    var tree;
    tree = new YAHOO.widget.TreeView(“treeDiv1”);
    tree.setDynamicLoad(loadDataForNode);

    function loadDataForNode(node, onCompleteCallback) {
    // retrieve data from javascript variable, ref question nr.1 HOW?
    // iterate data and recreate the tree
    onCompleteCallback();
    }

  9. Sandeep Soni says:

    To answer these properly, let me know how exactly are you using the treeview control in a JSF page? I will give one way of doing it. Yours might differ …
    Say in your JSF page, you are using f:verbatim to put in this tree control.

    <f:verbatim>
    treeview init ....
    function loadDataForNode(node, onCompleteCallback) {
    // retrieve data from javascript variable, ref question nr.1 HOW?
    var xml = readXmlStringFromHiddenField()
    // iterate over xml string and populate field.
    onCompleteCallback();
    }
    </f:verbatim>
    <h:inputHidden name="dataXML"  value="#{bean.dataXML}"/>
    <h:commandButton name="search"..../>
    

    Let the tree be rendered based on values from hi:inputHidden field say called “dataXML”. The h:inputHidden can be hooked up to a bean property as above. So when the search button is clicked, the search method in the bean is called, it should set the value of this hidden field to an appropriate XML data.
    Then your loadData function is supposed to read this XML string in the hidden field and then proceed to populate the tree.

  10. Viggo Navarsete says:

    Hi again,
    I think I will try to use either RichFaces or ICEFaces instead of jmaki. They got a lot of components, even tree components. Have you any experience with them? Can you recommand any of them?

  11. tsao ty says:

    Sorry, I fail here.
    After my project is created, I add "Portlet 1.0 Support" framework to that project.
    then show error msg :
    A java.lang.NullPointerException exception has occurred. detail is org.netbeans.modules.portalpack.portlets.genericportlets.framework
    Anyone can tell me why ? How resolve it ?
    Thanks!

  12. tsao ty says:

    My Error msg detail :(lose some words before)
    org.netbeans.modules.portalpack.portlets.genericportlets.frameworks.jsr168.PortletApplicationWizardPanel.getData (PortletApplicationWizardPanel.java:116)
    Thanks! again.

  13. Satya says:

    Thanks for trying this out !!!
    So what operating system are you using ?
    Are you able to add other frameworks like "Java Server Faces"/Struts to webapplication ?
    I assume you are using NB 6 M10 .
    If possible could you please post the nb error log file which can be found at
    $USER_HOME/.netbeans/6.0/var/log/messages.log

  14. Anonymous says:

    my OS: WinXP SP2
    my Install files:
    jdk-6u2-windows-i586-p.exe
    netbeans-6.0-nightly-200708160000-javaee-windows.exe
    portal-pack-plugin-2_0_preview.zip
    org-netbeans-modules-portalpack-portlets-genericportlets.nbm
    org-netbeans-modules-portalpack-servers-base_psframework.nbm
    org-netbeans-modules-portalpack-servers-opensourcepc.nbm
    portlet-container-configurator.jar
    jsf-portlet.jar
    I try add other frameworks "Java Server Faces"/Struts to webapplication is OK!
    no any error messages.
    my error log:({Username}\.netbeans\dev\var\log\messages.log)
    my message.log too long.
    Which methods i can post to you?

  15. tsao ty says:

    I cut 2 sections. hope is useful.
    ——————————————————————————-
    >Log Session: Friday, August 17, 2007 8:18:30 AM CST
    >System Info:
    Product Version = NetBeans IDE Dev (Build 200708160000)
    Operating System = Windows XP version 5.1 running on x86
    Java; VM; Vendor = 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06; Sun Microsystems Inc.
    Java Home = E:\Servers\Java\jdk1.6.0_02\jre
    System Locale; Encoding = zh_TW (nb); MS950
    Home Directory = C:\Documents and Settings\bee2
    Current Directory = E:\Servers\NetBeans 6.0 200708160000
    User Directory = C:\Documents and Settings\bee2\.netbeans\dev
    Installation = E:\Servers\NetBeans 6.0 200708160000\nb6.0
    E:\Servers\NetBeans 6.0 200708160000\ide8
    E:\Servers\NetBeans 6.0 200708160000\java1
    E:\Servers\NetBeans 6.0 200708160000\xml1
    E:\Servers\NetBeans 6.0 200708160000\apisupport1
    E:\Servers\NetBeans 6.0 200708160000\enterprise4
    E:\Servers\NetBeans 6.0 200708160000\profiler2
    E:\Servers\NetBeans 6.0 200708160000\visualweb1
    E:\Servers\NetBeans 6.0 200708160000\identity1
    E:\Servers\NetBeans 6.0 200708160000\harness
    E:\Servers\NetBeans 6.0 200708160000\platform7
    Boot & Ext. Classpath = E:\Servers\Java\jdk1.6.0_02\jre\lib\resources.jar;E:\Servers\Java\jdk1.6.0_02\jre\lib\rt.jar;E:\Servers\Java\jdk1.6.0_02\jre\lib\sunrsasign.jar;E:\Servers\Java\jdk1.6.0_02\jre\lib\jsse.jar;E:\Servers\Java\jdk1.6.0_02\jre\lib\jce.jar;E:\Servers\Java\jdk1.6.0_02\jre\lib\charsets.jar;E:\Servers\Java\jdk1.6.0_02\jre\classes;E:\Servers\Java\jdk1.6.0_02\jre\lib\ext\dnsns.jar;E:\Servers\Java\jdk1.6.0_02\jre\lib\ext\localedata.jar;E:\Servers\Java\jdk1.6.0_02\jre\lib\ext\sunjce_provider.jar;E:\Servers\Java\jdk1.6.0_02\jre\lib\ext\sunmscapi.jar;E:\Servers\Java\jdk1.6.0_02\jre\lib\ext\sunpkcs11.jar
    Application Classpath = E:\Servers\NetBeans 6.0 200708160000\platform7\lib\boot.jar;E:\Servers\NetBeans 6.0 200708160000\platform7\lib\org-openide-modules.jar;E:\Servers\NetBeans 6.0 200708160000\platform7\lib\org-openide-util.jar;E:\Servers\Java\jdk1.6.0_02\lib\dt.jar;E:\Servers\Java\jdk1.6.0_02\lib\tools.jar
    Startup Classpath = E:\Servers\NetBeans 6.0 200708160000\platform7\core\core.jar;E:\Servers\NetBeans 6.0 200708160000\platform7\core\org-openide-filesystems.jar;E:\Servers\NetBeans 6.0 200708160000\nb6.0\core\org-netbeans-upgrader.jar;E:\Servers\NetBeans 6.0 200708160000\nb6.0\core\locale\core_nb.jar
    ——————————————————————————-
    嚴重的 [global]
    java.lang.NullPointerException
    at org.netbeans.modules.portalpack.portlets.genericportlets.frameworks.jsr168.PortletApplicationWizardPanel.getData(PortletApplicationWizardPanel.java:116)
    at org.netbeans.modules.portalpack.portlets.genericportlets.frameworks.jsr168.JSR168WebFrameworkProvider.extend(JSR168WebFrameworkProvider.java:73)
    at org.netbeans.modules.web.project.ui.customizer.WebProjectProperties.save(WebProjectProperties.java:373)
    at org.netbeans.modules.web.project.ui.customizer.CustomizerProviderImpl$OptionListener.actionPerformed(CustomizerProviderImpl.java:138)
    at org.netbeans.modules.project.uiapi.CustomizerDialog$OptionListener$1.run(CustomizerDialog.java:182)
    at org.openide.util.Mutex.writeAccess(Mutex.java:321)
    at org.netbeans.modules.project.uiapi.CustomizerDialog$OptionListener.actionPerformed(CustomizerDialog.java:180)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6038)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.awt.Component.processEvent(Component.java:5803)
    at java.awt.Container.processEvent(Container.java:2058)
    at java.awt.Component.dispatchEventImpl(Component.java:4410)
    at java.awt.Container.dispatchEventImpl(Container.java:2116)
    at java.awt.Component.dispatchEvent(Component.java:4240)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
    at java.awt.Container.dispatchEventImpl(Container.java:2102)
    at java.awt.Window.dispatchEventImpl(Window.java:2429)
    at java.awt.Component.dispatchEvent(Component.java:4240)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    [catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

  16. satyaranjan says:

    This is a bug in the current Portal Pack 2.0 preview version. If you select "portlet support" during project creation it works fine. But if you add it later to a web application it throws above NPE.
    This bug is fixed and the fix will be available in the next Portal Pack 2.0 Beta release.

  17. Jason Williams says:

    I have done what you said and have everything working. However, when I create a tab and attempt to attach an event handler for clicking on it. It does not work.
    Here is what I tried to do.
    Added a tab as below.
    <webuijsf:tab actionExpression="#{Page1.tab3_action}" binding="#{Page1.tab3}" id="tab3" text="Tab 3">
    <webuijsf:panelLayout binding="#{Page1.layoutPanel3}" id="layoutPanel3" style="height: 128px; position: relative; width: 213px; -rave-layout: grid"/>
    </webuijsf:tab>
    Then attached an event handeler.
    public String tab3_action() {
    System.out.println("in the tab3 action");
    // TODO: Process the action. Return value is a navigation
    // case name where null will return to the same page.
    return null;
    }
    Here is what happened instead of my event handler being called.
    Initializing Sun’s JavaServer Faces implementation (1.2_04-b19-p03) for context ‘/WebApplication3’
    PSPL_PAECSPPAI0012 : Portlet Initialized: jsfsampleportlet.
    PSPL_PCCSPCPCI0002 : Invoking AppName:/WebApplication3, PortletName:jsfsampleportlet, Action:RENDER
    PSPL_PAECSPPA0007 : No resource bundle for portlet: jsfsampleportlet and locale: en_US
    PSPL_PCCSPCPCI0002 : Invoking AppName:/WebApplication3, PortletName:jsfsampleportlet, Action:ACTION
    java.lang.IllegalStateException: PWC1227: Cannot forward after response has been committed
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:366)
    at com.sun.portal.portletcontainer.driver.DriverServlet.doGet(DriverServlet.java:102)
    at com.sun.portal.portletcontainer.driver.DriverServlet.doPost(DriverServlet.java:110)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:624)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:624)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:624)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:268)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:631)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:562)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:803)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
    at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:361)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
    PSPL_PCCSPCPCI0002 : Invoking AppName:/WebApplication3, PortletName:jsfsampleportlet, Action:RENDER
    PSPL_PAECSPPA0007 : No resource bundle for portlet: jsfsampleportlet and locale: en_US
    Is there any way to correct this?

  18. satya says:

    Jason,
    I tried the same scenario as explained in your comments. Though I am not getting any exception in log, event handling is not working with tab set and tab in case of portlet. Looks like an issue in jsfportlet bridge. The same application when deployed as a web app works fine. Could you please report this issue on jsfportletbrige project ?
    https://jsfportletbridge.dev.java.net
    I will also give an another try to find the actual problem.

  19. Okali Chigozie says:

    Posted by Sandeep Soni on July 30, 2007 at 07:22 PM IST #
    Hi again, I think I will try to use either RichFaces or ICEFaces instead of jmaki. They got a lot of components, even tree components. Have you any experience with them? Can you recommand any of them?
    ===========================
    I support Sandeeps’ view of RichFaces and IceFaces having more components than jMaki.
    Please do we have the Netbeans module plugin file (.nbm) for any of the two to ease the process of development with them
    since you can only work with them if you really know how to tweak and nest the tags very well

  20. michael says:

    I got everything up and running on portal container 2.0, but I want it to be deployed on JBOSS. When I go here:
    C:\Projects\JDocXpt\JBoss Portal\JBoss Portal\jboss-portal-2.6.1.GA\server\default\deploy
    and copy-paste my war file, I start getting a lot of java exceptions:
    13:45:02,877 INFO [TomcatDeployer] deploy, ctxPath=/ProcessManagement, warUrl=.
    ../tmp/deploy/tmp15804ProcessManagement-exp.war/
    13:45:04,158 ERROR [STDERR] org.jboss.portal.portlet.container.PortletInitializa
    tionException: The portlet Process Management threw a runtime exception during i
    nit
    13:45:04,158 ERROR [STDERR] at org.jboss.portal.portlet.impl.jsr168.PortletC
    ontainerImpl.start(PortletContainerImpl.java:264)
    13:45:04,158 ERROR [STDERR] at org.jboss.portal.portlet.impl.container.Portl
    etApplicationContextImpl.startPortletApplication(PortletApplicationContextImpl.j
    ava:130)
    .
    .
    .
    .
    13:45:04,377 ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeployme
    ntScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
    13:45:04,377 ERROR [STDERR] Caused by: java.lang.ClassCastException: com.sun.fac
    es.portlet.FacesPortlet
    13:45:04,377 ERROR [STDERR] at org.jboss.portal.portlet.impl.jsr168.PortletC
    ontainerImpl.start(PortletContainerImpl.java:231)
    13:45:04,377 ERROR [STDERR] … 73 more
    Does anybody have any idea on what to do next? Any help is greatly appreciated.

  21. Cyrus says:

    Hi satya,
    can you please let me how to develop JSF portlets and deploy them in JBoss,
    I have tried most tutorials but I keep on getting an error. thanks a lot for your help.
    cheers,
    Freddy

  22. Viggo Navarsete says:

    Hi Freddy!
    What are your actual problems? Are you planning on using either IceFaces/Richfaces/Woodstock/or other as component libraries? Are you planning to use MyFaces or RI implementation?
    I’ve had several startup problems as you have, but I think I’m heading in the right direction now:)
    I’ve landed on using Richfaces as a component library as I think they provide the best forum support, good-looking components and very good documentation. There is also a Richfaces portlet example available from here:
    http://anonsvn.jboss.org/repos/portletswap/portlets/src/framework/RichFacesPortlet
    There aren’t many tutorials out there on JSF portlet programming, but hopefully you will get some help from the different communities, either from IceFaces or Richfaces if you plan on using on of them. When I have time, I will also start to blog about the (very hard and steep) learning curve I’ve had starting to develop JSF portlets.
    Good luck, and don’t hesistate to send me an email if you have more questions!!
    Best regards,
    Viggo Navarsete

  23. Freddy says:

    Hi Satya,
    thanks for your quick reply. managed to develop a JSF portlet and deployed it in JBoss, but now I see the following error in my Netbeans 6 IDE:
    "java.lang.IllegalStateException: Must be a RenderResponse"
    can you please let me know whats wrong if you have a clue.
    cheers,
    Freddy

  24. satya says:

    Have you added "jsf-portlet.jar" as compile time library in your NetBeans Project ? If yes, then delete it from there and add it as package library. So that it will be packaged in the final war but it will not be there in the project classpath during development.
    FYI, you can try the new "Visual Portlet Builder" module available in "Portal Pack Beta 3" to develop the JSF Based portlet in NetBeans IDE. You don’t need to do all manual steps mentioned in this blog.
    Steps to create Visual JSF Portlet :
    – Create a Web Application
    – Add "Visual JSF Portlet Page" to it

  25. Freddy says:

    Hi Satya,
    in the library i get the portlet 1.0(jsr168) library, should I add it also?
    cheers,
    Freddy

  26. Freddy says:

    Hi Satya,
    I now get the following error:
    "java.lang.NoSuchMethodError: javax.faces.component.UIViewRoot.encodeAll(Ljavax/faces/context/FacesContext;)V"
    on the browser after I create an instance of the protlet and assign a page to it. it only appears when I view the page!
    thank you a lot for your help.
    cheers,
    Freddy

  27. Shaik says:

    Hi Satya
    I am using Netbean 6.0,JSF Visual web designer to design my portlets . Now i want to deploy my portlets to Jboss portal server 2.6.3. Could you please let me know the steps which i need to follow to do same.
    Thanks in advance
    -Shaik

  28. AlexMarktl says:

    Hello!
    I’ve got a problem!
    I’m trying to develop a simple portlet using woodstock, I want to display some data from a database, but all i get is the header of the table but no content!
    Any idea???
    It’s working as simple JSF Project, so I don’t have any clue where the problem might be!
    so long!
    Alex

  29. satya says:

    Alex,
    Which portalserver/portletcontainer are you using as runtime ? If you are deploying the application on OpenPortal Portlet Container then you have to use 12thFeb stable nightly build of Portlet container.
    https://portlet-container.dev.java.net/public/Download.html
    It has some fixes for JSF Portlet. Anyway I will try the exact scenario with the woodstock table and let you know.
    Thanks,
    Satya

  30. Peter says:

    Hi Satya!
    Have the same problem as Alex! Using the latest beta of Openportal container 2 and the beta portlet modules. Got the same result with version 1 of the Openportal container as well as with liferay 4.4.x.
    The problem seems to be the themelinks tag. The current version of the taglib no longer has an "axaxify" attribute. Thus I have used the "webuiJsfx" attribute instead.
    I’ve started with a plain woodstock JSF app. Everything works fine and data from db tables is displayed. However, as soon as I use the themeLinks tag, the data in the table is not display any data any longer (but at least an empty table). When I add the JSF Bridge and deploy the app as a portlet, I only get the header of the woodstock table but no data. Other woodstock components (like buttons and input fields) aren’t rendered at all. Good old JSF Tags (h:outputText) work just fine. The required woodstock stylesheet seems to be missing, thus only plain text of the table heading is rendered.
    When debugging the portlet and comparing the call stack with a working woodstock app, I found out, that the woodstock lifecycle seems to be broken. None of the init and prerender methods gets called. The "rave" Viewhandler is also not involved, also the Lifecyclelistener that comes with woodstock.
    Any Idea to get this fixed???
    Peter

  31. David Epps says:

    Hi Satya,
    can you help me with a JSF portlet deployment. I sent out the details on the Sun portal-interest alias today with details:
    Regarding deploying JSF portlets built with the new Portal Pack 2 for PS 7.2 – I have a simple JSF based portlet that runs fine in the OSPC 2.0 beta and deployed from netbeans 6.1.
    When I deploy it to PS7.2 on a server using the sandbox anonymous desktop, it fails to render anything with "Error getting content" and the portal1.0.0.log exception shown below, with portlet war attached.
    Are there any tricks, gotchas etc to make JSF portlets work going from OSPC to server portal 72? I changed the deployment target in NB before rebuilding and manually deployed the war using psconsole (the PS7.2 plugin fails to deplot portlets from netbeans 6.1)
    Have to demo this for a customer POC Weds, so any help appreciated!
    [#|2008-03-24T18:06:56.102-0400|SEVERE|SJS Portal Server|debug.com.sun.portal.desktop.context|ThreadID=299; ClassName=com.sun.portal.desktop.context.ReusableProviderCaller;
    MethodName=run; |PSDT_CSPDC0025 : Exception thrown from JSPTabContainer/ING/ING/ING_CSR
    com.sun.portal.providers.ProviderException: WindowProvider.getContent():container exceptioncom.sun.portal.container.ContainerException: PortletContainer.getMarkup():getting content java.io.FileNotFoundException: /servlet/PortletAppEngineServlet
    at com.sun.portal.providers.window.WindowProvider.getPortletContent(WindowProvider.java:384)
    at com.sun.portal.providers.window.WindowProvider.getContentInternal(WindowProvider.java:247)
    at com.sun.portal.providers.window.WindowProvider.getContent(WindowProvider.java:212)
    at com.sun.portal.providers.portletwindow.PortletWindowProvider.getContent(PortletWindowProvider.java:109)
    at com.sun.portal.desktop.context.ReusableProviderCaller.run(ReusableProviderCaller.java:206)
    com.sun.portal.container.ContainerException: PortletContainer.getMarkup():getting content java.io.FileNotFoundException: /servlet/PortletAppEngineServlet
    at com.sun.portal.portletcontainer.impl.PortletContainer.getMarkup(PortletContainer.java:286)
    at com.sun.portal.providers.window.WindowProvider.getPortletContent(WindowProvider.java:382)
    at com.sun.portal.providers.window.WindowProvider.getContentInternal(WindowProvider.java:247)
    at com.sun.portal.providers.window.WindowProvider.getContent(WindowProvider.java:212)
    at com.sun.portal.providers.portletwindow.PortletWindowProvider.getContent(PortletWindowProvider.java:109)
    at com.sun.portal.desktop.context.ReusableProviderCaller.run(ReusableProviderCaller.java:206)
    java.io.FileNotFoundException: /servlet/PortletAppEngineServlet
    at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:732)
    at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:384)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:855)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:660)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:578)
    at com.sun.portal.portletcontainer.impl.PortletContainer.invokePAE(PortletContainer.java:792)
    at com.sun.portal.portletcontainer.impl.PortletContainer.invokePAE(PortletContainer.java:675)
    at com.sun.portal.portletcontainer.impl.PortletContainer.getMarkup(PortletContainer.java:236)
    at com.sun.portal.providers.window.WindowProvider.getPortletContent(WindowProvider.java:382)
    at com.sun.portal.providers.window.WindowProvider.getContentInternal(WindowProvider.java:247)
    at com.sun.portal.providers.window.WindowProvider.getContent(WindowProvider.java:212)
    at com.sun.portal.providers.portletwindow.PortletWindowProvider.getContent(PortletWindowProvider.java:109)
    at com.sun.portal.desktop.context.ReusableProviderCaller.run(ReusableProviderCaller.java:206)
    |#]

  32. Ganesh says:

    I am getting following message in portlet window insted of displaying jsf component in portlet
    "Wait..portlet webapp is being deployed."
    Please give some comment how this problem will resolve

  33. Jason Williams says:

    com.sun.faces.lifecycle.PARTIAL is now implemented in the bridge. Does this mean that ajax widgits can be used?

  34. shakti says:

    I have constructed a tree usinh richfaces for jsf.
    can you help me in showing another page while clicking a node of the tree.

  35. Kashif says:

    Hello,
    I am using RichFaces. When I deploy it as a web application, I can get the desired result. But when I add portlet capabilities to it, and then deploy it to portlet container, I get this message
    "Wait..portlet webapp is being deployed"
    I am using JSF-Portlet Bridge by OpenPortal. Please help me.

  36. satya says:

    Can you check the app server log file and send the error stack trace ?

  37. Jonathan Cooper says:

    Satya,
    I am having problems deploying a Visual Web JSF Portlet page to JBoss 2.6.6. I am using NetBeans 6.1 and can deploy the portlet to the OpenPortlet Portal Container 2.0 with no problem, but deploying to JBoss always results in exceptions when trying to view the portlet. I have tried to make a very simple portlet by using the NetBeans wizard for creating a Web Application and choosing "OpenPortal Portlet Container 2.0" as the server and using JavaEE5. I only select "Portlet Support" on the Frameworks page, and leave the default of version 2.0. I also select the "Create Portlet" and "Create JSPs" options.
    After the project is created, I right-click it and add a "Visual Web JSF Portlet Page". One odd thing about this window is that I have to fill out the portlet information on the bottom of this window ("Portlet Name", description, etc.) for the first page I add, but it is grayed out if I add any more Visual Web JSF pages to the project.
    After creating the JSF page, I normally add a button or static text field with some unique text so I know when I am seeing the correct portlet and then compile and deploy the war. However, considering the issues I have read about Woodstock widgets, I have even tried this process without adding anything to the JSF page and get the same error.
    Cause: javax.portlet.PortletException
    StackTrace:
    javax.portlet.PortletException
    at com.sun.faces.portlet.FacesPortlet.renderFaces(FacesPortlet.java:416)
    at com.sun.faces.portlet.FacesPortlet.doView(FacesPortlet.java:318)
    at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
    at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
    at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl$Invoker.doFilter(PortletContainerImpl.java:568)
    at org.jboss.portal.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:159)
    at org.jboss.portal.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:80)
    at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:505)
    Can you please help me, or is this something that JBoss will need to fix?

  38. Jonathan Cooper says:

    Satya,
    I should have also mentioned that the "JSF Guessnumber Portlet for JSF 1.2" sample portlet (https://jsfportletbridge.dev.java.net/public/Download.html) from the "OpenPortal JSF Portlet Bridge" works correctly when I deploy it to the JBoss server.
    Thank you for any help,
    Jon

  39. Satya says:

    Jon,
    Are you getting any other error may be JSF related ? Please check if you are getting any error during portlet deployment time. I have not checked visual web jsf portlet on JBOSS server yet. But ideally it should run. I will give it a try and let you know.

  40. Jonathan Cooper says:

    Satya,
    Thank you for replying so quickly. It appears that I was wrong, I am getting errors when deploying to JBoss 2.7 Beta. I deployed to JBoss 2.6.6 today and everything worked fine. It seems this may be a JBoss issue with their latest release so I will contact them for further assistance.
    – Jon

  41. Dhandapani says:

    I have created visual web jsf portlet with in net beans 6.5. glassfish v3 liferay bundle, after deploying this application, just I went to add application and I added my portlet, In the portal page, portlet window is opening , but component (webuijsf) is not displaying in the portlet window. Can u plz any one help me for this issue
    Thanks for timely help in advance
    Dhandapani S

  42. sitinurnamira says:

    hi, i tried this example but im using netbeans 6.7.1. However, i encounter error. The error is in the ApplicationBeans1.java under the source packages. The error is on this line: public class ApplicationBean1 extends AbstractApplicationBean { & import com.sun.rave.web.ui.appbase.AbstractApplicationBean;. They say that they can’t find symbol for the word ‘com’ and ‘AbstractApplicationBean’.
    Lastly this error:
    SEVERE: ERROR: ‘cvc-pattern-valid: Value ” is not facet-valid with respect to pattern ‘($|_|\p{L})(\p{L}|\p{Nd}|_|$)*’ for type ‘null’.’
    SEVERE: WebModule[/WebApplication1]PWC1275: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
    Please anyone help me.I appreciate it alot.

  43. JKoder says:

    The url “http://blogs.sun.com/satya/entry/easy_steps_to_set_up” provided above is broken. Can anybody suggest me, how to proceed further

  44. shakeelstha says:

    Is this the original post ???? “https://blogs.oracle.com/satya/entry/build_jsf_portlet_with_netbeans”

  45. satya says:

    Yes. But that was the workaround when portal pack didn’t have visual web jsf support. In Portal Pack 3.0, jsf portlet through Visual Web Pack was supported.

    https://ranjansatya.wordpress.com/2008/03/17/new-visual-jsf-portlet-builder-in-portal-pack-beta-3/

    But that support was later removed because as VWP was removed in later version of NetBeans.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s