Creating an independent client that can talk to a Geronimo EJB application
Brief introduction
This article will show you how to develop independent (FAT) clients that can communicate with EJB applications running within the Geronimo application server. Based on my first two articles-"Three ways to connect a database to a Geronimo application Server" (developerworks,2005 June) and "Go deep into an EJB Web application with Geronimo" (developerworks,2005 years July)--This article shows you a Swing client that connects to a small phone book database built using a Geronimo EJB application. You will read the brief design instructions and then read information about the client libraries needed to run the application. Next I'll explain how to connect to the server and perform operations on the remote stateless session bean on the server. Finally, you will learn how to develop, compile, and run client applications, and how to configure the server to allow secure access from specific clients on your network.
Design Overview
Let's start with a brief introduction to the sample application design--a unified Modeling Language (Unified Modeling Language, UML) deployment diagram that describes the phone book client application, as shown in Figure 1. The client application connects to Geronimo through its EJB port and talks with the phonebook session EJB to manipulate the data in the database through phonebook Entry container-managed Persistence (CMP) 。
Figure 1. Phone Book client deployment diagram
The default release of Geronimo has restrictions on the EJB port. You can connect to a client application only if it is running on the same machine and is connected through a loopback address (localhost or 127.0.0.1). Later in this article, configuring the EJB Ports section of Geronimo provides detailed information about how to get clients on other machines to access the server.
Client library for connection to Geronimo
For client applications to be able to connect to the EJB port of Geronimo and communicate with the EJB layer, the following Java libraries must be in the client classpath:
Geronimo-spec-j2ee-1.4-rc4.jar
Geronimo-kernel-1.0-snapshot.jar
Geronimo-j2ee-1.0-snapshot.jar
Geronimo-security-1.0-snapshot.jar
Cglib-nodep-2.1.jar
Openejb-core-2.0-snapshot.jar