Chapter 1. GWT and EJB3 with EasyBeans

Table of Contents

1.1. Requirements
1.1.1. JDK
1.1.2. Eclipse
1.1.3. EasyBeans
1.1.4. Tomcat
1.1.5. Google Web Toolkit
1.2. Starting with GWT
1.2.1. Creating an Eclipse Project
1.2.2. Adding a GWT Application to the Eclipse project
1.3. Calling EJB3 beans with an RPC service
1.3.1. Defining the interface of the service
1.3.1.1. Service interface
1.3.1.2. Asynchronous interface
1.3.2. Classes used by the interfaces
1.3.2.1. The GridData class
1.3.2.2. The ServiceException exception
1.3.3. Implementation of the service
1.3.3.1. Implementation service class
1.3.3.2. Accessing to an EJB3 from this Remote Service.
1.3.3.3. Calling facade bean from the remote service
1.3.4. Calling Remote service from client side.
1.3.4.1. The gwt.xml file
1.3.4.2. Calling service from client side.
1.4. Packaging of the application for running on a web container.
1.4.1. Creating the web.xml file
1.4.2. Generating the AJAX client that will be embedded into the war file
1.4.3. Packaging of the .war file
1.5. Deploying applications for GWT/EasyBeans
1.6. Launch of the Google Web Toolkit tools
1.7. Comments

Abstract

The GWT (Google Web Toolkit) will be used as the framework for producing clients using AJAX technique while EJB3 will be on the server side in order to provide some services (like persistence).

EJB3 can ease the developers for the persistence part (with Java Persistence API) or for the business part.

The source of an application using EasyBeans and GWT can be browse on the Fisheye Sudoku EasyBeans site. The application is a Sudoku Game and this howto use some code of this application.

Figure 1.1. Sudoku Game demo using GWT and EasyBeans

Sudoku Game demo using GWT and EasyBeans

1.1. Requirements

1.1.1. JDK

A JDK 5.0 is required to use EasyBeans.

[Tip]Tip

GWT only support JDK 1.4 functions. So classes that will be transformed by GWT into JavaScript shouldn't use JDK 5 features (like annotations). Other classes can use the new features (like the EJB3).

1.1.2. Eclipse

GWT can be used without Eclipse but in this HowTo, Eclipse is used.

1.1.3. EasyBeans

This HowTo is done by using the EasyBeans Tomcat package. Note that it works with the JOnAS package too.

EasyBeans can be downloaded from EasyBeans Web Site.

1.1.4. Tomcat

Tomcat 5.5.17 was used. It should work with other versions. Download from Tomcat site.

1.1.5. Google Web Toolkit

Toolkit can be downloaded from the Google Web Toolkit download page.