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. Implementing the Service
1.3.3.1. Implementation Service Class
1.3.3.2. Accessing an EJB3 from this Remote Service
1.3.3.3. Calling the Facade Bean from the Remote Service
1.3.4. Calling the Remote Service from the Client Side
1.3.4.1. The gwt.xml File
1.3.4.2. Callingathe Service from the 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 in the War File
1.4.3. Packaging of the .war File
1.5. Deploying Applications for GWT/EasyBeans
1.6. Launching the Google Web Toolkit Tools
1.7. Comments

Abstract

The GWT (Google Web Toolkit) will be used as the framework for producing clients using the AJAX technique, while EJB3 will be on the server side providing some services (such as persistence).

EJB3 can help developers with the persistence aspects (with the Java Persistence API) or with the business aspects.

The source of an application, a Sudoku Game, that uses EasyBeans and GWT can be viewed on the Fisheye Sudoku EasyBeans site using a browser. This howto uses some of the code from this application.

A tgz package is also provided on the EasyBeans forge.

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 supports JDK 1.4 functions. Therefore, classes that will be transformed by GWT into JavaScript should not use JDK 5 features (such as annotations). Other classes can use the new features (like the EJB3).

1.1.2. Eclipse

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

1.1.3. EasyBeans

This HowTo uses the EasyBeans Tomcat package. Note that it also works with the JOnAS package or any other EasyBeans package.

EasyBeans can be downloaded from the EasyBeans Web Site.

1.1.4. Tomcat

Tomcat 5.5.20 was used. It should work with other versions as well. Download this software from Tomcat site.

1.1.5. Google Web Toolkit

The Toolkit can be downloaded from the Google Web Toolkit download page. The version used in this HowTo is the 1.3 RC1 version running on Linux. This is the first open source version of GWT released with an Apache 2.0 license.