Java SE security tutorial - Step 2

Before you can verify that the SimpleApp.java sample runs, you need to start a catalog server and a container server. After starting these services successfully, you can then launch the client and run the sample. Additional security features are added incrementally in the steps of the tutorial to increase the amount of integrated security that is available.

Before you begin

To successfully complete this step of the tutorial, you should have access to the following files:
  • Have access to the compiled sec_sample.jar package. This package contains the SimpleApp.java program.
  • Have access to the necessary configuration files SimpleApp.xml and SimpleDP.xml.
You should have created these files in Java SE security tutorial - Step 1 of this tutorial.

You should also know how to:

Procedure

  1. In a command line window, go to the wxs_home/bin directory and start the catalog service.
    • [Unix][Linux] ./startOgServer.sh catalogServer
    • [Windows] startOgServer.bat catalogServer
  2. Start a container service named c0:
    • [Unix][Linux] ./startOgServer.sh c0 -objectGridFile ../xml/SimpleApp.xml -deploymentPolicyFile ../xml/SimpleDP.xml -catalogServiceEndPoints localhost:2809
    • [Windows] startOgServer.bat c0 -objectGridFile ..\xml\SimpleApp.xml - deploymentPolicyFile ..\xml\SimpleDP.xml -catalogServiceEndPoints localhost:2809
  3. After the catalog server and container server have been started, run the sec_sample.jar sample as follows: java -classpath ../lib/objectgrid.jar:../applib/sec_sample.jar com.ibm.websphere.objectgrid.security.sample.guide.SimpleApp

    java -classpath ..\lib\objectgrid.jar;..\applib\sec_sample.jar com.ibm.websphere.objectgrid.security.sample.guide.SimpleApp The output of the sample is: The customer name for ID 0001 is fName lName The getObjectGrid method in this class obtains an ObjectGrid, and the run method reads a record from the customer map and updates the value in the accounting grid.
  4. Verify the size of the "customer" map inserted into the "accounting" grid, by issuing the xscmd command utility as follows:
    • [Unix][Linux] ./xscmd.sh -c showMapSizes -g accounting -ms mapSet1
    • [Windows] xscmd.bat -c showMapSizes -g accounting -ms mapSet1
  5. Stop a container server named c0 with one of the following scripts:
    • [Unix][Linux] ./stopOgServer.sh c0 -catalogServiceEndPoints localhost:2809

    • [Windows] stopOgServer.bat c0 -catalogServiceEndPoints localhost:2809

    If the server stopped successfully, then you will see the following message:

    CWOBJ2512I: ObjectGrid server c0 stopped.

  6. Stop the catalog server with one of the following scripts:
    • [Unix][Linux] ./stopOgServer.sh catalogServer -catalogServiceEndPoints localhost:2809

    • [Windows] stopOgServer.bat catalogServer -catalogServiceEndPoints localhost:2809

    If the server stopped successfully, then you will see the following message:

    CWOBJ2512I: ObjectGrid server catalogServer stopped.