Sun ONE logo
Portal J2EE Sample Count Application

 

Portal J2EE Sample Count Application
 

This document describes how to utilize the Portal J2EE sample Count application in conjunction with Sun ONE Application Server version 7.

This sample application document contains the following sections:

Overview 

The Count sample is a simple application that demonstrates a custom Portal Server JSP provider accessing a stateless session EJB which increments a counter each time a call is made to the bean's remote interface. Starting with the Portal Server 6.1 release, custom portal providers can gain access to J2EE features such as JNDI, EJB, ODBC and JMS that are available only in J2EE containers. This allows Portal Server to serve content generated from J2EE components and resources that are made available by the underlying J2EE compliant platform.

This document assumes that the Portal Server 6.1 and above release is already deployed on Sun ONE Application Server 7.0 and that you have selected the default installation options with the sample desktop. You must also have superuser(root) privileges for the system where Portal Server is deployed. 

A snapshot of the sample portal desktop with the count sample is shown below. Note the channel titled "J2EE Sample - Count" displays the current EJB counter value to be 17.
 

Count Sample Snapshot

Step by Step Deployment Guide 



  1. install Portal Server 6.1 or above release on Sun ONE Application Server 7.0. Make sure to install the sample portal since this sample depends on the sample desktop.

  2. Setup your system to leverage the Sun ONE Application Server 7.0 development environment. This includes setting the PATH environment to include the following directory:

  3.  

    <app_server_base_dir>/bin
     

  4. Install/Unpack Portal J2EE samples if not already done so. Navigate to the portal server sample deployment root directory for Sun ONE Application Server 7.0 as follows:

  5.  

    cd <portalsample_basedir>/j2eesample/deploy/s1as
     

  6. Edit the common.properties file and review the default value for each property. The default property values are set according to the default installation options for Portal Server 6.2 release on Sun ONE Application Server. A description of each property and their default values are listed in the following table:

  7.  

    Property Description Default Value
    com.sun.aas.javaRoot The JDK directory. For default Sun ONE application server v7.0, this is /usr/j2se. However, Portal Server MAS installation will install JDK 1.4.1_01 and make modifications to the application server's configuration file to use this jdk. /usr/java_1.4.1_01
    admin.host This is the hostname where the Sun ONE application server v7.0 admin server is running.
    com.sun.aas.imqLib This is the directory where Sun ONE application server v7.0 finds the implementation of JMS provider. /usr/share/lib/imq
    admin.port This is the port number where the Sun ONE application server v7.0 admin server is listening to 4848
    com.sun.aas.installRoot The base directory where Sun ONE application server v7.0 is installed into /opt/SUNWappserver7
    admin.user The user id of the administrator account for the Sun ONE application server v7.0 admin server admin
    sunone.instance The server instance name where portal server is deployed server1
    com.sun.aas.webServicesLib The directory where web services library files reside /usr/share/lib
    com.sun.aas.pointbaseRoot The base directory where pointbase is installed into /opt/SUNWappserver7/pointbase
    com.sun.dsame.installRoot
    The base directory where Identity Server is installed into
    /opt/SUNWam
    com.sun.portal.installRoot
    The base directory where Portal Server is installed into
    /opt/SUNWps
    com.sun.portal.deployuri The deployment uri used when deploying portal server on Sun ONE application server v7.0 /portal
    com.sun.portal.websrcRoot The portal server open WAR file root directory
    /opt/SUNWps/web-src
    com.sun.portal.provider.classBaseDir The base directory where portal provider class files are deployed /etc/opt/SUNWps/desktop/classes
    com.sun.portal.templateBaseDir The base directory where provider templates and JSP are deployed /etc/opt/SUNWps/desktop
    com.sun.portal.desktopType The portal server deployed desktop type default
    sunone.instance.port The port number where the Sun ONE application server instance is listening to 80

     
  8. Navigate to the count sample directory for Sun ONE Application Server 7.0 as follows:

  9.  

    cd <portalsample_basedir>/j2eesample/deploy/s1as/count
     

  10. Compile the stateless counter EJB and the custom portal provider by giving the following command:

  11.  

    asant compile
     

  12. Package and create the EJB jar file by giving the following command:

  13.  

    asant jar
     

  14. Deploy the stateless counter EJB jar to the application server by giving the following command:

  15.  

    asant deployejb
     

  16. Deploy the custom portal JSP provider class file and its JSP file to the proper directories using the following command: (note that this requires super user privilege)

  17.  

    asant deployprovider
     

  18. Make the necessary modifications to the portal server web.xml and sun-web.xml files to include references to the Count EJB. These modifications should be made under the portal server open war file source directory. Modifications made in the portal server open war file source directory are guarantee to be effective even when a change such as a patch is applied to the portal server in the future. Locate the portal server open war file source directory and change directory to it. The default portal server open war file source directory is /opt/SUNWps/web-src. This may change depending on the specific directory where portal server is installed into. (note that this requires super user privilege)

  19.  

    cd /opt/SUNWps/web-src
     

  20. Create a new xml file named CountSample.xml under the subdirectory of WEB-INF/xml by copying an existing xml file in that directory and removing all the lines between the <web-app> and </web-app> tags in the CountSample.xml file. Append the following lines to CountSample.xml between the <web-app> and </web-app> tags and save the file:

  21.  

    <ejb-ref>
    <ejb-ref-name>ejb/counter</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.sun.portal.sample.j2ee.count.ejb.CountHome</home>
    <remote>com.sun.portal.sample.j2ee.count.ejb.Count</remote>
    </ejb-ref>
     

  22. Edit the sun-web.xml under the subdirectory of WEB-INF to append the following entries at the end of the file.

  23.  

    <ejb-ref>
    <ejb-ref-name>ejb/counter</ejb-ref-name>
    <jndi-name>ejb/count</jndi-name>
    </ejb-ref>
     

  24. Copy the stateless EJB counter client jar file, CountClient.jar , to the subdirectory of WEB-INF/lib. The CountClient.jar file is generated by the application server as a result of the EJB deployment in step 8. You can normally find this jar file under the application server web application/module deployment directory such as /var/opt/SUNWappserver7/domains/domain1/server1/applications/j2ee-modules/Count_1.
  25. Redeploy the portal server by running the following command:

  26.  

    asant redeploy_portal_war
     
     

  27. Restart the application server.
     

    asadmin stop-appserv
    asadmin start-appserv
     
     

  28. Login to the Portal Server Admin Console and select the "Service Management" view at the top pane. Click the property icon next to "Desktop Service" in the left pane. Click "Edit XML" and append the content in the <portalsample_basedir>/j2eesample/src/com/sun/portal/sample/j2ee/count/dp-CountProvider.xml into the textarea. This will make the provider available for use by a channel.

  29.  
  30. In the Portal Server Admin Console, select the "Identity Management" view at the top pane. Select "Service" in the pulldown in the left pane. Click on the property next to "Desktop Service". Click on "Channel and Container Management" in the content. Under the channel section, create a new channel base on the "CountProvider" and name it "Count". Save the channel. Under the container channels section, edit the "MyFrontPageTabPanelContainer" container and move the newly created "Count" channel to the available and selected channel list of the container. Save the changes.

  31.  
  32. Login to portal server as a regular desktop user and bring up the desktop. You should see a channel named "Portal J2EE Sample -Count" in the front page. The channel displays the current value of the EJB counter after each page refresh.

  33.  

Troubleshooting 


Copyright © 2002 Sun Microsystems, Inc. All rights reserved. 
Last Updated February 14, 2003