PDK Lite V 4.1 setup

This readme describes how to setup the Pattern Development Kit sample in the following environments:

IBM WebSphere Application Server V4.0, Advanced Edition

This section provides details on installing and running the PDK sample application in IBM WebSphere Application Server V4.0, Advanced Edition.

Before you start

Before you start installing PDK Lite, check the following prerequisites:

System requirements

PDK Lite has the following system requirements:

  • Operating system:
    • PDK Lite has been deployed on the following operating systems:
    • Windows 2000 Server Service Pack 2
    • AIX 5.1
    • Red Hat Linux 7.2
  • Hardware:
    • Intel platform: 500Mhz Pentium (Windows or Linux)
    • AIX platform: RS/6000 at 375Mhz
    • 384 MB RAM minimum, 512 MB recommended

Products required

The following product levels were used to develop and test PDK Lite. Please install these products at the specified version levels before attempting to install and run PDK Lite:

  • IBM WebSphere Application Server V4.0, Advanced Edition (including IBM HTTP Server V1.3.19) (get a free trial copy here) .
  • IBM DB2 Universal Database UDB 7.2 (get a free trial copy here) .
  • WebSphere and DB2 fixpack upgrade to V4.0.2 and V7.2.5 (Get the necessary WAS and Db2 upgrade)
  • IBM MQSeries V5.2.
  •  

    Note: It is possible to run the PDK sample without installing MQSeries (or the MA88 support pack). You may notice installation and run-time errors due to the missing components. However, other back-end integration technologies should still work.

  • MQSeries MA88 support pack (download the support pack here) . The latest version of the support pack is required, which includes connector.jar in the MQSeries java/lib directory.
  • IBM CICS JCA resource adapter.
    • The CICS ECI JCA adapter we used is available with the IBM CICS Transaction Gateway V4.0.2 for Windows, AIX and Linux.
    • Alternatively, you can download the blackbox sample adapter provided in the J2EE Connector Architecture 1.0.1 Sample Source and Binary Code Adaptor from http://java.sun.com/j2ee/sdk_1.3 . JCA CICS and Enterprise Service back-end integration will not be available, but the PDK sample will install.
     

    Important: The PDK installation will fail if you don't have a JCA resource adapter.

  • IBM WebSphere Application Server V4.1, Enterprise Edition is required if you want to try the Enterprise Services scenario (JCAEIS).
  • Internet Explorer 5.0 or Netscape Navigator 4.7 (or higher).

Information required

Before starting the PDK installation, make sure you have the following information available:

Installing the PDK sample

To install the PDK sample application in WebSphere Application Server V4.0.2, Advanced Edition:

  1. Download the PDK sample.
  2. Extract the PDK sample to the required location, for example: C:\ or /usr.
  3. Make sure you are logged in as a user with administrative privileges:
    • In Windows, make sure you are a member of the 'Administrators' group.
    • On AIX or Linux, make sure you login as root.
    • For MQSeries integration, make sure you are a member of the 'mqm' group.
  4. Check that system library path is correctly set up for MQSeries JMS support:
    • In Windows, the system PATH environment variable should include <MQ_HOME>\Java\lib. For example, C:\MQSeries\Java\lib;...
    • In AIX, the system LIBPATH environment variable should include <MQ_HOME>/java/lib. For example, /usr/mqm/java/lib:...
    • In Linux, the system LD_LIBRARY_PATH environment variable should include <MQ_HOME>/java/lib. For example, /opt/mqm/java/lib:...
  5. Open a command window and change to the PDK_Lite folder:
    • On Windows, for example:
      • cd \PDK_Lite
    • On AIX or Linux, for example:
      • cd /usr/PDK_Lite
  6. Edit the PDK environment variables setup script to match your environment:
    • On Windows, edit environment.cmd.
    • On AIX or Linux, edit environment.sh.
    • Check the environment settings carefully, including case, as any errors will cause the PDK installation to fail. When entering product paths, DO NOT add quotes, EVEN IF the path includes spaces.
  7. Set the script file permissions on AIX and Linux systems, from the PDK_Lite folder:
    • chmod 755 *.sh
    • chmod 755 TestDrive/Install/*/*.sh
    • chmod 755 TestDrive/Uninstall/*/*.sh
  8. Start the run_all script, from the PDK_Lite folder:
    • On Windows:
      • run_all.cmd
    • On AIX or Linux:
      • ./run_all.sh

Running the PDK sample

When the run_all script completes, you should be able to access the sample Web site with the URL http://localhost/selfservice/index.html. Click Continue to enter the site. You can then start the PDK application by clicking Run Application in the side menu.

You will be presented with a start screen showing the Guild's coat of arms, and a 'Click here to get the latest balances' link. Clicking will display the balances for all weather stations and the Guild of Weather Masters. From there you can then enter an amount to transfer from the Guild to one of the stations using a text entry field and a drop-down menu. Once you have submitted your transfer request, you will be told whether it has succeeded or failed. You can then return to the balance display page to review the balances.

Running the PDK Lite MQSeries server application

A Java process will be started automatically at install time which acts as a server for MQSeries messages triggered by the running of the JMS scenario. If this process is stopped and subsequently needs restarted, you can do so by running the command file PDK_Lite\TestDrive\Install\17MQSetup\PDKServerStart.cmd on Windows, or PDKServerStart.sh on AIX or Linux.

Changing the default settings

Once you have installed the PDK, it is ready to run without any alteration. However, there are options you can specify to produce different effects, or to change the underlying technologies used, without having to change any source code.

Selecting different topologies

The Finance Session controls which topology will be used for each planet in order to retrieve the exchange rate during a funds transfer. By default, the topologies which are executed are:

To change the topology, edit the properties file packaged with the Finance session EJB. After installation of the PDK this file can be found in the <WAS_HOME>/installedApps/PDK_Lite.ear/FinanceEJB.jar file, and is named FinanceTopology.properties. Edit this file, select the desired topology and save it before restarting the PDK Server in WebSphere Application Server. After the FundsTransfer command completes successfully you will be reminded of the topology used.

Configuring access to a CICS server

The PDK sample application can be configured to access a CICS server using the following options:

Source code for our CICS application is available in com/ibm/pdk/eis/exchangeCICSECI/calcrate.c included in ExchangeRateEIS.jar.

Configuring access to a remote Web services server

The PDK sample application can be configured to access the back-end Web service running in a remote application server as follows:

  1. Deploy PDK WebServices.ear on the remote application server.
  2. On the local PDK Server, edit the ExchangeRateWSBean.properties file in ExchangeRateWSEJB.jar and change the hostname entry from localhost to the remote server's hostname.
  3. Restart the local PDK Server.

Changing the results page

By default, the weather stations are displayed in a rich graphical page, using special view bean methods to calculate the number of different pieces of weather reading equipment a station can afford. If you would like to use a simpler (and faster) display:

  1. Edit the DisplayFundsServlet.properties file under the guild_funds Web module directory <WAS_HOME>\installedApps\PDK_Lite.ear\PDKLiteWeb.war.
  2. Use a '#' character to comment out the line:
    • resultsPage=/displayFundsRichResults.jsp
    • and remove the '#' from the start of the line:
    • #resultsPage=/displayFundsSimpleResults.jsp
  3. Re-start the default server from the WebSphere administrative console, and when you run the Web application, a different JSP will be used (this file is read from the DisplayFundsServlet's init() method).

Using the Command Factory

Servlets in the Web application determine which type of Command to use by making a call to the CommandFactory singleton class's getCommand(String type) method, passing the fully qualified class name of the interface the command must implement (for example, com.ibm.pdk.command.GetAllBalancesCommand). This factory reads from the configuration file CommandFactory.properties, which is part of the commandUtil.jar archive stored at the top level of the PDK EAR file (<WAS_HOME>\installedApps\PDK_Lite.ear\commandUtil.jar). This maps interfaces to implementing classes. If you decide to write a new implementation, say, of the GetAllBalancesCommand interface, edit this file to specify your new class as that which the factory should return. Then export it, along with you class file in to the commandUtil.jar file.

Using the Command Target Factory

Similarly the type of Command Target to use is determined by making a call to the CommandTargetFactory class's getTarget() method. This returns an instance of the first valid class listed in the CommandTargetFactory.properties file, which is part of the commandTargetUtil.jar archive. To change the default Command Target, you must also edit this file, thus:

Adding new weather stations

You can add your own weather stations to the PDK Lite, by following these steps:

  1. Edit the file stations.txt under the PDK_Lite\TestDrive\Install\10ImportStationData directory and add in a new station name and a starting funds balance, for example: "MERCURY",575000
  2. Run the runImportStationsData script to import your new station data into the database.
  3. Add your new weather station to the stationsList environment entry in FinanceEJB.jar, for example, MARS:JUPITER:NEPTUNE:PLUTO:MERCURY.
    • You can set the environment entry in the FinanceEJB deployment descriptor, meta-inf\ejb-jar.xml, included in the JAR file. You can also use the Application Assembly Tool (type assembly from a command prompt).
  4. To supply an image for your new station, you must use the file naming convention of '<STATION_NAME>.gif', and copy your file to the <WAS_HOME>\installedApps\PDK_Lite.ear\PDKLiteWeb.war\images\stations directory.
  5. Re-start the PDK Server from the WebSphere administrative console.
  6. Your new weather station should appear with the others when you click the link to get the latest balances. Its name will also be added to the drop-down menu for you.

Improving performance

You can make the guild_funds Web application run faster by disabling the comments written to the <WAS_HOME>/logs/PDK/stdout.txt file by the Java components in the PDK (servlets, command beans, and so on). By default, 'debug' mode is set to true. To set to false:

  1. Edit the file Logger.properties, found in the utility.jar file which is included in each of the PDK enterprise applications (PDK_Lite.ear, PDK_WebServices.ear, PDK_CommandServer.ear).
  2. Change the line debug=true to debug=false.
  3. Re-start the PDK Server from the WebSphere administrative console.

IBM WebSphere Studio Application Developer Integration Edition

Check that you are using the Integration Edition of IBM WebSphere Studio Application Developer before using this procedure. If you don't have Integration Edition, use the procedure described in See IBM WebSphere Studio Application Developer.

 

Note: This procedure assumes that you have already set up the required application databases, and MQSeries queues and queue manager. These items are set up during the procedure described in See IBM WebSphere Application Server V4.0, Advanced Edition.

To install the PDK sample application in the IBM WebSphere Studio Application Developer Integration Edition V4.1.1 for Windows workspace:

  1. Download the PDK sample.
  2. Extract the PDK sample to the required location, for example: C:\.
  3. Check that system library path is correctly set up for MQSeries JMS support:
    • In Windows, the system PATH environment variable should include <MQ_HOME>\Java\lib. For example, C:\MQSeries\Java\lib;...
  4. Start Application Developer using the -data option to specify the PDK workspace folder, for example:
    • wsappdev.exe -data C:\PDK_Lite\TestDrive\Resources\workspacePDK
  5. Check the MQ_HOME workspace classpath variable:
    • In Application Developer, select Window -> Preferences -> Java -> Classpath Variables from the main menu.
  6. Check the enterprise application paths:
    1. Open the Server perspective.
    2. In the Navigator view, open PDKLite -> META-INF -> application.xml .
    3. If you get a message about auto-correcting the absolute path, click Yes then save application.xml.
    4. Close application.xml.
    5. Repeat 1 to 4 for the PDK CommandServer and ExchangeRateWSServerEAR enterprise applications.
  7. Install the JCA adapter in the workspace:
    1. Open the Enterprise Services perspective.
    2. Select Resource Adapters , then right-click and select New -> Add Resource Adapter in the pop-up menu.
    3. In the RAR Import window, select to the required RAR file, set the resource adapter name to "CICS ECI", and click Finish .
      • You can find the CICS ECI RAR file in com.ibm.wsadie.a.Cab in the IBM WebSphere Studio Application Developer Integration Edition CD-ROM/install package. Use WinZip to extract the RAR file.
  8. Check the server instance paths, JDBC settings, and JCA adapter:
    1. In the Server perspective, Navigator view, open PDKServer -> PDK Server Conf.wsc -> server-cfg.xml .
    2. If you get a message about auto-correcting the paths, click Yes .
    3. In the server-cfg.xml Data source view, select the XADb2Driver JDBC driver and check the Default user id and password settings for the Guild and Stations Data sources.
    4. Install the J2C resource adapter in the test server:
      1. In the J2C view, click the J2C Resource Adapters Add... button, then click OK to create the resource adapter.
      2. Click the J2C Connection Factories Add... button, set the Name and the JNDI name to ECICICS, then click OK to create the connection factory.
      3. Set the resource properties required for your environment, for example: ServerName, ConnectionURL, PortNumber, UserName, Password.
    5. Save server-cfg.xml if required then close server-cfg.xml.
  9. Check the MQ_HOME server path mapping:
    1. Start the PDK Test Domain server instance from the Server perspective, Servers view. (If the server instance isn't there, right-click the PDKServer project and select Refresh From Local .)
    2. Right-click the PDK Test Domain server instance and select Run administrative client from the pop-up menu.
    3. Login to the administrative client, then navigate to Nodes -> localhost -> Path Map -> Entries .
    4. Click the MQ_HOME symbolic name and check its path setting.
    5. Save the server configuration if required.
    6. Exit from the administrative client.
    7. Stop then restart the PDK Test Domain server instance.
  10. Add the required MQ JNDI names to the test server JNDI namespace and start the back-end MQSeries application:
  11.  

    Note: This step must be carried out every time you restart the PDK Test Domain server instance

    1. Make sure the required variables in the PDK environment setup script, PDK_Lite\environment.cmd, are correctly set for your environment.
    2. Open a command window.
    3. Change to the PDK_Lite\TestDrive\Install\17MQSetup folder
    4. To add the JNDI names, run the WSAD_JMSsetup script.
    5. Make sure the PDK queue manager is started, for example:
      • strmqm PDK.QUEUE.MANAGER
    6. To start the MQSeries back-end application, run the PDKServerStart script.
  12. Open the PDK home page:
    • In the Navigator view, select PDKLiteWeb , then right-click and select Run on Server from the pop-up menu.
  13. Try a funds transfer using Web services:
    1. Click the link to get the latest balances. Balances for each planet should be displayed.
    2. Enter an amount greater than zero, select To PLUTO (Pluto is configured to use Web services by default) and click Transfer .
    3. You should get a message that funds have been transferred to the designated weather station.
  14. Repeat for the other back-end connection technologies that are available in your environment. The default technologies for each planet are:
    • MARS uses JMS and MQSeries.
    • JUPITER uses JCA and CICS.
    • NEPTUNE uses Enterprise Services, JCA and CICS.
    • PLUTO uses Web services.
 

Note: If all the back-end connection technologies are not available in your environment you may notice compile-time and run-time errors due to the missing components. However, the available technologies should still work. The Web services back-end connection technology is the only option without external dependencies, so it should work in all cases.

IBM WebSphere Studio Application Developer

You can set up the PDK sample in IBM WebSphere Studio Application Developer, however, you will not be able to install the JCA adapter in the workspace or in the test server. The managed JCA adapter and Enterprise Service technologies are only available in IBM WebSphere Studio Application Developer Integration Edition.

 

Note: This procedure assumes that you have already set up the required application databases, and MQSeries queues and queue manager. These items are set up during the procedure described in See IBM WebSphere Application Server V4.0, Advanced Edition.

To install the PDK sample application in the IBM WebSphere Studio Application Developer V4.0.2 for Windows workspace:

  1. Download the PDK sample.
  2. Extract the PDK sample to the required location, for example: C:\.
  3. Check that system library path is correctly set up for MQSeries JMS support:
    • In Windows, the system PATH environment variable should include <MQ_HOME>\Java\lib. For example, C:\MQSeries\Java\lib;...
  4. Install the Application Developer zip creation plug-in:
    1. Open PDK_Lite\TestDrive\Resources\std\zipCreation.zip.
    2. Extract zipCreation.zip into the Application Developer installation/plugins folder, for example C:\Program Files\IBM\Application Developer\plugins.
    3. Verify that a new Application Developer installation/plugins/com.ibm.sample.zip.creation folder has been created.
     

    Note: You can find details on this plug-in in WebSphere Developer Domain article, Developing J2EE utility JARs in WebSphere Studio Application Developer , at:

    http://www7b.boulder.ibm.com/wsdd/library/techarticles/0112_deboer/deboer2.html

  5. Update PDK project files to use the Application Developer zip creation plug-in:
    1. Open PDK_Lite\TestDrive\Resources\std\zipConfig.zip.
    2. Extract zipConfig.zip into the same locate as the PDK sample, for example: C:\.
    3. You should be prompted to confirm overwrite of four .prj files and four .vcm_meta files. Click Yes to confirm each file overwrite.
  6. Start Application Developer using the -data option to specify the PDK workspace folder, for example:
    • wsappdev.exe -data C:\PDK_Lite\TestDrive\Resources\workspacePDK
  7. Check the MQ_HOME workspace classpath variable:
    • In Application Developer, select Window -> Preferences -> Java -> Classpath Variables from the main menu.
  8. Check the enterprise application paths:
    1. Open the Server perspective.
    2. In the Navigator view, open PDKLite -> META-INF -> application.xml .
    3. If you get a message about auto-correcting the absolute path, click Yes then save application.xml.
    4. Close application.xml.
    5. Repeat 1 to 4 for the PDK CommandServer and ExchangeRateWSServerEAR enterprise applications.
  9. Check the server instance paths and JDBC settings:
    1. In the Navigator view, open PDKServer -> PDK Server Conf.wsc -> server-cfg.xml .
    2. If you get a message about auto-correcting the paths, click Yes .
    3. In the server-cfg.xml Data source view, select the XADb2Driver JDBC driver and check the Default user id and password settings for the Guild and Stations Data sources.
    4. Save server-cfg.xml if required then close server-cfg.xml.
  10. Rebuild all projects in the correct order by right-clicking on each an selecting Rebuild Project from the pop-up menu. The required order is:
    1. PDKSupport
    2. PDKCommandUtil
    3. PDKCommandTargetUtil
    4. ExchangeRateEIS
    5. All remaining ExchangeRateXXX projects
    6. GuildEJB and StationsEJB
    7. FinanceEJB
    8. All PDK CommandServerXXX
    9. PDKLite and PDKLiteWeb
  11. Check the MQ_HOME server path mapping and add connector.jar to JMS provider:
    1. Start the PDK Test Domain server instance from the Server perspective, Servers view. (If the server instance isn't there, right-click the PDKServer project and select Refresh From Local .)
    2. Right-click the PDK Test Domain server instance and select Run administrative client from the pop-up menu.
    3. Login to the administrative client, then navigate to Nodes -> localhost -> Path Map -> Entries .
    4. Click the MQ_HOME symbolic name and check its path setting.
    5. Navigate to Resources -> JMS Providers .
    6. Select the IBM MQSeries JMS Provider.
    7. Add connector.jar to the start of the Server Class Path property:
      • ${MQ_HOME}/java/lib/connector.jar; ${MQ_HOME}/java...
    8. Click OK .
    9. Save the server configuration.
    10. Exit from the administrative client.
    11. Stop then restart the PDK Test Domain server instance.
  12. Add the required MQ JNDI names to the test server JNDI namespace and start the back-end MQSeries application:
  13.  

    Note: This step must be carried out every time you restart the PDK Test Domain server instance

    1. Make sure the required variables in the PDK environment setup script, PDK_Lite\environment.cmd, are correctly set for your environment.
    2. Open a command window.
    3. Change to the PDK_Lite\TestDrive\Install\17MQSetup folder.
    4. To add the JNDI names, run the WSAD_JMSsetup script.
    5. Make sure the PDK queue manager is started, for example:
      • strmqm PDK.QUEUE.MANAGER
    6. To start the MQSeries back-end application, run the PDKServerStart script.
  14. Open the PDK home page:
    • In the Navigator view, select PDKLiteWeb , then right-click and select Run on Server from the pop-up menu.
  15. Try a funds transfer using Web services:
    1. Click the link to get the latest balances. Balances for each planet should be displayed.
    2. Enter an amount greater than zero, select To PLUTO (Pluto is configured to use Web services by default) and click Transfer .
    3. You should get a message that funds have been transferred to the designated weather station.
  16. Repeat for the other back-end connection technologies that are available in your environment. The default technologies for each planet are:
    • MARS uses JMS and MQSeries.
    • JUPITER uses JCA and CICS (not available).
    • NEPTUNE uses Enterprise Services, JCA and CICS (not available).
    • PLUTO uses Web services.
 

Note: The managed JCA adapter and Enterprise Service technologies are only available in IBM WebSphere Studio Application Developer Integration Edition. You may notice compile-time and run-time errors due to the missing components. However, the available technologies should still work. The Web services back-end connection technology is the only option without external dependencies, so it should work in all cases.