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.
Running the automated deploy and configure
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.
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.
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.
Wlogin treats host names as case-sensitive
If you are running on Windows, and you did not change the
value of the
eas.host
and eas.http.port
properties
in the Ant build file, specify the host name in all uppercase letters
when running wlogin.
As installed, this property uses the value of the Windows COMPUTERNAME
environment variable, which is typically set in all uppercase letters.
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.
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:
Rebuilds ejbtut.jar (because this target depends on the JAR file).
Deploys ejbtut.jar to
the server address specified by the eas.host
and eas.http.port
properties.
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.
Restart or refresh the server and run the test client as described in “Create the client application” and “Run the client application”.