This discussion is archived
13 Replies Latest reply: May 13, 2008 7:23 AM by 796219 RSS

portlet deployment probelm (PS6.2)

807574 Newbie
Currently Being Moderated
Hi all.
     I have deployed a simple portlet using the pdeploy tool. It returned a success message; but i dont see my new portlet displayed, either in the amconsole or in the portal desktop.

and there is no evidence of my portlet in any of the logs.
Any hints to this problem, would be highly appreciated.


Source Code :
*************

package custom;

import javax.portlet.*;
import java.io.*;

public class HelloWorldPortlet extends GenericPortlet {
     public void doView(RenderRequest request, RenderResponse response) throws PortletException {
          try {
          response.setContentType("text/html");
          PrintWriter writer = response.getWriter();
          writer.write("Hello World");
     } catch(IOException ex) { }
     }
}



portlet.xml
***********

     <portlet-app>
          <portlet>
               <portlet-name> HelloWorldPortlet </portlet-name>
               <portlet-class> custom.HelloWorldPortlet </portlet-class>
               <expiration-cache> 0 </expiration-cache>
               <supports>
                    <mime-type> text/html </mime-type>
                    <portlet-mode>VIEW</portlet-mode>
               </supports>
               <portlet-preference>
                    <preference>
                         <name> locale </name>
                         <value> USA </value>
                    </preference>
               </portlet-preference>
          </portlet>
     </portlet-app>


web.xml
*******

     <?xml version="1.0" encoding="UTF-8"?>

     <!DOCTYPE web-app
     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
     "http://java.sun.com/dtd/web-app_2_3.dtd">

     <web-app>
          <display-name> Custom Portlet Example </display-name>
     </web-app>



deploy command
***************

/opt/SUNWps/bin/pdeploy deploy -u amadmin -w password -d o=jes -g /opt/HelloWorldPortlet.war

[o=jes -> our root DN]
following is the logs that we got while restarting amserver

Sun ONE Web Server 6.1 B09/11/2003 19:00
info: CORE3016: daemon is running as super-user
info: CORE5076: Using [Java HotSpot(TM) Server VM, Version 1.4.1_06] from [Sun Microsystems Inc.]
info: WEB0100: Loading web module in virtual server [https-apolloone.immchen.com] at [amserver]
info: WEB0100: Loading web module in virtual server [https-apolloone.immchen.com] at [amconsole]
info: WEB0100: Loading web module in virtual server [https-apolloone.immchen.com] at [ampassword]
info: WEB0100: Loading web module in virtual server [https-apolloone.immchen.com] at [amcommon]
info: WEB0100: Loading web module in virtual server [https-apolloone.immchen.com] at [portletsamples]
info: WEB0100: Loading web module in virtual server [https-apolloone.immchen.com] at [portal]
warning: WEB6100: locale-charset-info is deprecated, please use parameter-encoding
info: WEB0100: Loading web module in virtual server [https-apolloone.immchen.com] at [examples]
info: WEB0100: Loading web module in virtual server [https-apolloone.immchen.com] at [HelloWorldPortlet]
info: WEB0100: Loading web module in virtual server [https-apolloone.immchen.com] at [search]
info: WEB2798: [portal] ServletContext.log(): Setting param "jato:com.sun.portal.rewriter.admin.*:moduleURL" =      "../rwadmin" (java.lang.String) on servlet "RewriterServlet"
info: WEB2798: [portal] ServletContext.log(): Setting param "jato:com.iplanet.am.console.base.*:moduleURL" =      "../base" (java.lang.String) on servlet "AMBaseServlet"
info: WEB2798: [portal] ServletContext.log(): Setting param "jato:com.iplanet.am.console.user.*:moduleURL" =      "../user" (java.lang.String) on servlet "UMServlet"
info: HTTP3072: [LS ls1] http://apolloone.immchen.com:15003 ready to accept requests startup: server started successfully done.


Here, "HelloWorldPOrtlet", is the one that iam trying to deploy.

I tried to add portlet channel to desktop through Identity server. But my portlet name not displayed in the amconsole.

now friends, how can i check if the portlet really got deployed or not..or is there anything that i missed ?


Thanks in advance
veera
  • 1. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    Hi

    For me also same problem? pls help me any one
  • 2. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    Dear friends,
    i am also getting the same issue. i think this may be the major bug in portlet channel in portal server.if any one knows, fix this problem.



    thanx
    parthi
  • 3. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    Same problem with what I did as well.
  • 4. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    To clarify -

    I have followed the steps in the Portal Server 6.2 2005Q1 Developer's guide documentation to create the sample portlet called - PrefPortlet. I followed every step. In these steps I was not prompted to create a jsp. Someone has told me that every portlet has to have a jsp. Is this true? It appears to me in the example that the portlet creates the necessary html output. But either way that is a side issue.

    After I created the portlet java file and compiled it successfully, I then created the portlet.xml file and the web.xml file just like the steps say too. I then created the war file based upon the given directory structure given to me from the guide. I then figured out the pdeploy statement and was able to successfully deploy the web app. However, even though the deploy was a success. The portal had problems actually bringing in the web app. I went to the "errors" log and after reviewing it I figured out what was wrong. Now when I deploy it REALLY is deploying and the Portal Server REALLY is not giving any errors concerning the sample web app.

    However, when I go into the amConsole and try to create a channel from a portlet (following the steps from the Admin Guide from Sun) the new portlet does not show up in the list of portlets to create a channel from.

    Does anyone have any idea why? and how to fix this?

    Thanks,

    Cowboy
  • 5. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    In portlet.xml, replace <portlet-app> tag with:

    <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd /opt/SUNWps/dtd/portlet.xsd" version="1.0">

    It might work on your environment ;)
  • 6. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    Well, I'll try to help you.
    My sample Portlet works correctly.
    How i did it?
    Answer:
    My portlet file:
    package examples;
    import javax.portlet.GenericPortlet;
    import javax.portlet.ActionRequest;
    import javax.portlet.RenderRequest;
    import javax.portlet.ActionResponse;
    import javax.portlet.RenderResponse;
    import javax.portlet.PortletException;
    import javax.portlet.PortletURL;
    import javax.portlet.PortletMode;
    import javax.portlet.PortletPreferences;
    import javax.portlet.WindowState;
    
    import java.io.IOException;
    import java.io.PrintWriter;
    
    public class PrefPortlet extends GenericPortlet {
        public void processAction(ActionRequest request, ActionResponse response) throws PortletException {
            String salutation = request.getParameter("SALUTATION");
            try {
                PortletPreferences pref = request.getPreferences();
                pref.setValue("salutation", salutation);
                pref.store();
            } catch(Exception e) {
                throw new PortletException(e.getMessage());
            }
            response.setPortletMode(PortletMode.VIEW);
            response.setWindowState(WindowState.NORMAL);
        }
        public void doView(RenderRequest request, RenderResponse response) throws PortletException,IOException {
            PortletPreferences pref = request.getPreferences();
            String salutation = pref.getValue("salutation", "");
            response.setContentType(request.getResponseContentType());
            PrintWriter writer = response.getWriter();
            writer.write("<A HREF=" + salutation + ">SAP R/3 HOME PAGE</A>");
        }
        public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException {
            PortletURL actionURL = response.createActionURL();
            response.setContentType(request.getResponseContentType());
            PrintWriter writer = response.getWriter();
            writer.write("ENTER THE SAP R/3 HOME PAGE ");
            writer.write("<form method='post' action='" + actionURL.toString() + "'>");
            writer.write("<INPUT TYPE='TEXT' NAME='SALUTATION'>");
            writer.write("<INPUT TYPE='SUBMIT' NAME='SUB1' VALUE='OK'></form>");
        }
        public void doHelp(RenderRequest request, RenderResponse response) throws PortletException {
            response.setContentType(request.getResponseContentType());
            try {
                response.setContentType(request.getResponseContentType());
                PrintWriter writer = response.getWriter();
                writer.write("help is under construction. Come later.<p><p>");
                
            } catch(IOException e) {
              throw new PortletException("PrefPortlet.doHelp exception ", e);  
            }
        }
    }
    My web.xml file:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>Portlet Examples</display-name>
    </web-app>
    My portlet.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:portlet="http://java.sun.com/xml/ns/portlet"
    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
    /opt/SUNWps/dtd/portlet.xsd" version="1.0">
    <portlet>
    <portlet-name>PrefPortlet</portlet-name>
    <portlet-class>examples.PrefPortlet</portlet-class>
    <expiration-cache>0</expiration-cache>
    <supports>
    <mime-type>text/html</mime-type>
    <portlet-mode>EDIT</portlet-mode>
    <portlet-mode>HELP</portlet-mode>
    </supports>
    <portlet-info>
    <title>SAP R/3 CHANNEL</title>
    <keywords>Hello, world, test</keywords>
    </portlet-info>
    <portlet-preferences>
    <preference>
    <name>name</name>
    <value>World</value>
    </preference>
    </portlet-preferences>
    </portlet>
    </portlet-app>
    I copied my PrefPortlet, portlet.xml, web.xml to
    /opt/SUNWps/bin/examples/
    And now i have a examples folder in the bin/
    Next step:
    Compiling PrefPortlet.java with portlet.jar
    javac -classpath /opt/SUNWps/lib/portlet.jar /opt/SUNWps/bin/examples/WEB-INF/classes/examples/PrefPortlet.java
    javac created in examples folder file PrefPortlet.class
    Next step:
    go to the /opt/SUNWps/bin/examples/ folder to create *.WAR file.
    jar -cvf examples.war *
    jar created in /opt/SUNWps/bin/examples/ folder examples.war file. it contents:
    META-INF->MANIFEST.MF
    WEB-INF->classes/examples/PrefPortlet.class
    WEB-INF->portlet.xml
    WEB-INF->web.xml

    Next step: Deploying examples.war
    pdeploy deploy -u "uid=amadmin,ou=people,dc=labjes,dc=com" -w 11111111 -p 11111111 -g -v examples.war
    after deploing go to the folder:
    /var/opt/SUNWps/tmp/portlet/
    There you have to see examples.war file and examples_portlet.xml
    Next step:
    http://jes02.labjes.com/amconsole
    Portal Desktop->Manage channels and containers
    Find ther button new portlet channel.
    Channel: name myChannel
    Portlet: examples.PrefPortlet(choose it from combobox)
    OK.
    Go to the MyFrontPageTabPanelContainer
    There you see MyChannel in the list.
    Add your Portlet- myChannel to visible on the Portlat Desktop.
    Ready.
    Go to the http://hostname:port/portal
    Authorize yourself.
    And you see myChannel on MyFrontPageTabPanelContainer.
  • 7. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    Do you have to restart the server after running pdepoy command.?

    I cannot see the deployed portlets in the combobox until I restart the server.

    Damitha
  • 8. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    no, i did not restart Web Server, but if helps you you can restart it, i recommend you restart evary time when you deploy or undeploy.
    For example when i undeploied, my portlet was on portal yet, but when i restarted the web server disappeared.
  • 9. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    no, i did not restart Web Server, but if it helps you, you can restart it, i recommend you restart every time when you deploy or undeploy.
    For example when i undeploied, my portlet was on portal yet, but when i restarted the web server disappeared.
  • 10. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    i try to deploy a jsr-168 complaint cognos portlet in a sun studio, after having lot of chnages to the war file, i am able to deploy it without any errors, but when i go to amconsole and clicked on New Portlet Channel button and still i don't see the deployed portlet in the select box .. so any idea what's going on.. i tryed restarting the web server couple of times, but no luck...

    Thanks
    ramesh
  • 11. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    What command parameters are you passing to dpadmin?
  • 12. Re: portlet deployment probelm (PS6.2)
    807574 Newbie
    Currently Being Moderated
    I didn't use the dpadmin command, i just used the pdeploy command to deploy the portlet and it gave the successfull message and don't see any errors in the log files too, but it doesn't show up in amconsole when i try to create a new portlet channel..

    Thanks
    ramesh
  • 13. Re: portlet deployment probelm (PS6.2)
    796219 Newbie
    Currently Being Moderated
    I had the same problem. Deployment showed no error on the console, but the portlets did not show up in the combo box.

    I finally figured out that the -d option has to reference a unit and not a user, so this worked
    -d "o=Developersample,dc=red,dc=iplanet,dc=com"
    and this not
    -d "uid=developer,ou=people,o=Developersample,dc=red,dc=iplanet,dc=com"