Run the client application

If you have not refreshed or restarted your server since last modifying the tutorial components, data source, or user account, refresh the server now before running the client. Otherwise, verify that the server is running.

Run the client from using a batch file or UNIX shell script. The batch file or shell script configures the CLASSPATH environment variable, then runs the application using the JDK 1.4 java program included with your EAServer installation.

StepsCreating the Windows batch file

  1. Create a file named runtest.bat in your copy of the EJB tutorial directory, containing the commands below:

    @SETLOCAL
    @echo off
    call settings.bat
    call %DJC_HOME%\bin\djc-setenv.bat
    set JAVAHOME=%DJC_JAVA_HOME_14%
    set CLASSPATH=%DJC_HOME%\lib\eas-server-14.jar
    set CLASSPATH=%CLASSPATH%;%DJC_HOME%\deploy\ejbjars\ejbtut
    set CLASSPATH=%CLASSPATH%;.\client-classes
    set CLASSPATH=%CLASSPATH%;%DJC_HOME%\genfiles\java\classes
    "%JAVAHOME%\jre\bin\java" com.sybase.easerver.tutorials.ejb.client.TestClient %* 
    

StepsCreating the UNIX shell script

  1. Create a file named runtest containing the commands below:

    #!/bin/sh 
    . settings.sh
    . $DJC_HOME/bin/djc-setenv.sh
    set JAVAHOME=$DJC_JAVA_HOME_14
    set CLASSPATH=${DJC_HOME}/lib/eas-server-14.jar
    set CLASSPATH=$CLASSPATH:${DJC_HOME}/deploy/ejbjars/ejbtut
    set CLASSPATH=$CLASSPATH:./client-classes
    set CLASSPATH=$CLASSPATH:${DJC_HOME}/genfiles/java/classes
    export CLASSPATH
    export JAVAHOME
    "$JAVAHOME/jre/bin/java" com.sybase.easerver.tutorials.ejb.client.TestClient $*
    
  2. Change the file permissions to allow the script to be executed. For example:

    chmod 777 runtest
    

StepsRunning the client application

  1. Run the batch or script file, specifying the server host name and IIOP port number on the command line as follows:

    runtest iiop://host:iiop-port
    

    For example:

    runtest iiop://myhost:2000
    

The client application:

  1. Creates a proxy for the Glossary entity bean’s home interface, then calls the create method to populate the database with some glossary entries.

  2. Creates a proxy for Query session bean’s home interface, then calls the runQuery method to get a result set containing all the entries, then prints them.

If errors occur, check the server log file for information on how to correct the problem.