![]() |
Portal J2EE Sample Connector Application |
Portal J2EE Sample Connector Application
This document describes how to utilize the Portal J2EE sample Connector application in conjunction with Sun ONE Application Server version 7 and Portal Server 6.1 or above release.
This sample application document contains the following sections:
Overview
The Connector sample is a simple application that demonstrates a custom Portal Server JSP provider that interacts with backend services through a sample JCA connector. The sample allows the user to submit a message from the portal channel to the JCA connector which in turns passes the message to the backend server. Upon receiving the message, the backend server sends a response which travels back through the JCA connector to the portal provider. The portal provider then displays the message in a channel of the desktop.
Starting with the Portal Server 6.1 release, custom portal providers can gain access to J2EE features such as JNDI, EJB, ODBC, JMS and JCA connectors that are only available in J2EE containers. This allows Portal Server to provide content generated from any J2EE components and resources that are made available by the underlying J2EE compliant platform.This document assumes that the Portal Server 6.1 or above release is already deployed on Sun ONE Application Server 7.0 and that you have selected the default installation options and have installed 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 connector sample is shown below. Note the channel titled "J2EE Sample - Connector" displays the message from the backend service.
- 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.
- 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:
<app_server_base_dir>/bin
- Install/Unpack Portal J2EE samples if not already done so. Navigate to the potal server sample deployment root directory for Sun ONE Application Server 7.0 as follows:
cd <portalsample_basedir>/j2eesample/deploy/s1as
- 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:
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
- Navigate to the connector sample directory for Sun ONE Application Server 7.0 as follows:
cd <portalsample_basedir>/j2eesample/deploy/s1as/connector
- Compile the backend server, the connector and assemble the backend server jar file and the connector rar file by giving the following command:
asant core
- Deploy the sample JCA connector by giving the following command:
asant deployconnector
- 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)
asant deployprovider
- 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)
cd /opt/SUNWps/web-src
- Create a new xml file named JCASample.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 JCASample.xml file. Append the following lines to JCASample.xml between the <web-app> and </web-app> tags and save the file:
<resource-ref>
<res-ref-name>eis/Comet</res-ref-name>
<res-type>javax.resource.cci.ConnectionFactory</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
- Edit the sun-web.xml under the subdirectory of WEB-INF to append the following entries at the end of the file.
<resource-ref>
<res-ref-name>eis/Comet</res-ref-name>
<jndi-name>Comet</jndi-name>
<default-resource-principal>
<name>dummy</name>
<password>dummy</password>
</default-resource-principal>
</resource-ref>
</ejb-ref>- Copy the connector jar file, comet.jar ,to WEB-INF/lib subdirectory inside the portal server open war file source directory. The comet.jar file is generated by the ant build script and placed in the sample home directory.
- Redeploy the portal server by running the following command:
asant redeploy_portal_war
- Restart the application server.
asadmin stop-appserv
asadmin start-appserv
- 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/connector/dp-ConnectorProvider.xml into the textarea. This will make the provider available for use by a channel.
- 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 "ConnectorProvider" and name it "Connector". Save the channel. Under the container channels section, edit the "MyFrontPageTabPanelContainer" container and move the "Connector" channel to the available and selected channel list of the container. Save the changes.
- Start the backend server process by giving the following command:
java -classpath ./backend.jar com.sun.portal.sample.j2ee.connector.backend.Server 8020
- Login to portal server as a regular desktop user and bring up the desktop. You should see a channel named "Portal J2EE Sample -Connector" in the front page. Type in your name in the textbox and click the "EXECUTE" button. You should see a response from the backend server displayed in the same channel after the desktop is redisplayed.
- Make certain that values in the common.properties file are set correctly to reflect your Portal Server instllation on Sun ONE Application Server installation.
- You need to have superuser privilege in order to execute certain commands in the step by step guide.
- If you encounter problems when running the application, review the log files at <install-dir>/domains/domain1/<server-instance>/logs/server.logto learn what went wrong.
- The application admin console should show that the Comet connector has been successfully deployed.
Copyright © 2002 Sun Microsystems, Inc. All rights reserved.