Automating deployment and configuration

This section demonstrates how to modify the Ant build to deploy the EJB-JAR file to EAServer and how to use a Sybase configuration file to automate the post-deployment configuration steps.

StepsRunning the automated deploy and configure

  1. In your working copy of the tutorial files, copy the file sybase-ejbjar-config.xml from the example-config subdirectory to the manifest/META-INF directory.

    The sybase-ejbjar-config.xml contains definitions of a configure-user and recompile-user target. EAServer calls these targets after deploying the EJB-JAR file. The configure-user target creates the data source used to connect to the database and the sample user account that the client uses to login.

  2. Edit build.xml with a text or XML editor. Find the definition of the eas.host and eas.http.port properties. These must match the host name and HTTP port number of the server that you deploy to. As shipped, the eas.host value matches the string returned by the HOSTNAME environment variable (on UNIX platforms) or COMPUTERNAME environment variable (on Windows platforms). Edit the values if you are deploying to a server on another machine or the server uses a different HTTP port number than the default 8000.

  3. Create a wlogin session to the server that you are deploying to, using the default system account, admin@system, or another account with admin-role membership. You can use the same account that you use to login to the Management Console. For information on wlogin, see Chapter 12, “Command Line Tools,” in the System Administration Guide.

  4. Optionally undeploy the tutorial components from EAServer. You can do this with the undeploy command-line tool. For example:

    undeploy -server host:8000 ejbjar-ejbtut
    

    For information on undeploy, see Chapter 12, “Command Line Tools,” in the System Administration Guide.

  5. At a command prompt, change to your working directory for the tutorial and run the following command to rebuild and deploy the EJB-JAR file:

    ./build deploy
    

    This command runs build.bat, which runs Ant to build the deploy target. This target:

    1. Rebuilds ejbtut.jar (because this target depends on the JAR file).

    2. Deploys ejbtut.jar to the server address specified by the eas.host and eas.http.port properties.

    3. Copies the database file, gloss.db, to the data subdirectory in the EAServer installation if it is not already there. If successful, you should see the output of the EAServer deployment.

  6. Restart or refresh the server and run the test client as described in “Create the client application” and “Run the client application”.