Deploying the jar File
Now you are ready to deploy your jar file. Start JRun's administration server, and bring up the
administration application. Log in to the application using the username and password that you
set up during installation. On the left side of the window, expand the entry in the tree for JRun
Default Server. Select the link at the bottom of the tree for Enterprise JavaBeans.
The main window now displays the main page for the EJB tool. On this page you can select
the option for deployment, which then brings up the page for deploying EJB jar files. Click the
Browse button and choose the jar file that contains your EJBs. Also make sure that the selec-
tion under JRun Server Name is JRun Default Server.
You will use a large text box for placing deployment properties to deploy a data source to the
container. This is the data source that the entity beans will use to interact with the database.
The data source must be set up on your system and be associated with a valid database. On
Microsoft Windows systems, you can add a data source by using the Data Sources (ODBC)
tool under the Control Panel|Administrative Tools.
Add the following code snippet to JRun's Deploy Properties text box:
The name of the data source, bookDataSource , is also the name specified for all of the SQL
statements in the individual bean's properties files.
Now everything is ready for deployment. Click the Deploy button and wait. It takes a moment
for the EJB compiler to be run and for everything to be packaged. After it is finished you will
receive a message in red text on the left side of the page. Hopefully it tells you that deploy-
ment was successful. After you have successfully deployed the beans, you must restart the
Viewing Deployed Beans
Now that your Enterprise JavaBeans are deployed, you can view all of the deployment infor-
mation associated with each bean by expanding the navigation tree in the left panel of the
administration application. Expand the entry titled Enterprise JavaBeans, and it will list all of
your deployed beans. Select the bean you want to view and all of the information will appear
in the main window.
Servlets as EJB Clients
Listing 12.9 contains the source for a simple servlet that accepts the necessary parameters, cal-
culates the monthly loan payment, and then stores the quote to the database.