The buzz about Apache Beehive

Programming techniques for open source SOA tools

Beehive is a new Apache project that simplifies Java™ 2 Platform, Enterprise Edition (J2EE) and Web services programming. This article shows how to get started with Beehive and offers a sneak preview of Pollinate, an Eclipse plug-in that creates Beehive applications.


Kunal Mittal (, Portal/J2EE Architect, Consultant

Author photoKunal Mittal is a consultant specializing in Java, J2EE, and Web services technologies. He is the co-author of and has contributed to several books on these topics. Kunal is currently working on a portal project for Sony Pictures Entertainment. For more information, visit his Web site at

19 April 2005

On May 25, 2004, BEA Systems Inc. and Apache announced the birth of the Beehive project. This project focuses on simplifying J2EE and Web services programming by using a concept of annotations that is fast becoming a part of Java technology. Service-Oriented Architecture (SOA) development is also a major emphasis of this project.

Beehive was released under the Apache License V2.0, and BEA is widely promoting the project. Today, about half of Beehive committers are BEA employees, which is clear evidence other people in the community are contributing to this project.

The Apache Beehive project was created to support:

  • Java Page Flow (JPF) technology, also known as (NetUI)
  • Controls
  • Web services based on JSR 181

Together, these technologies fit into the Model-ViewController (MVC) programming model, as shown in Figure 1. The JPF technology forms the controller layer. The NetUI tag libraries participate in the view layer. The model layer is built from Java controls.

Figure 1. MVC model and Apache Beehive technologies
MVC model and Apache Beehive technologies

The Pollinate plug-in

Together, NetUI, controls, and Web services are targeted at making J2EE and SOA development easier. An Eclipse plug-in project called Pollinate is also in progress. This project will allow developers to use Eclipse to build Apache Beehive applications. I am confident that other IDEs, such as IntelliJ and JBuilder, will soon start supporting Apache Beehive, as well.

Let us take a look at each of the technologies within Apache Beehive in a little more detail.

NetUI or JPFs

If you have used BEA WebLogic Workshop V8.1, you have probably used JPF technology, which is built directly on top of Struts. As you probably know, Struts is one of the most widely adopted MVC frameworks in the market today. So, if JPFs are built on top of Struts, why not just use Struts?

JPFs leverage the core functionality of Struts, but remove a lot of the grunt work that Struts requires. By grunt work, I mean managing the deployment configuration files (such as the struts-config.xml file). The original version of Page Flows from BEA introduced a declarative programming language that BEA WebLogic Workshop automatically generated and maintained. In contrast, the Apache Beehive version of Page Flows uses JSR 175 for its metadata definition. JSR 175 is a metadata specification that allows you to reduce the J2EE coding required.

The JPF technology also comes with a set of tag libraries called NetUI. In the typical MVC design pattern, JPFs form the controller layer. They are assisted by the NetUI tag libraries in the presentation layer. JPFs also leverage all the Struts features, such as the validation framework. You can actually have a single Web application that has a combination of Struts and JPFs.

Listing 1 shows a simple JPF controller that prints HelloWorld.

Listing 1. Simple JPF controller for HelloWorld
import org.apache.beehive.netui.pageflow.PageFlowController;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
import org.apache.beehive.netui.pageflow.Forward;

@Jpf.Controller (
    simpleActions= {
       @Jpf.SimpleAction (name="cancel", path="")

public class HelloWorldController extends PageFlowController {

   @Jpf.Action (
       forwards= {
           @Jpf.Forward (name="success", path="helloworld.jsp")
   public Forward begin() {
      return new Forward("success");

Notice the heavy use of annotations. I first use the @Jpf.Controller annotation to define that this class is a JPF controller. The @Jpf.SimpleAction annotations define the actions within this controller. These annotations are similar to the concept of actions in Struts. The @Jpf.Action annotation defines the action itself. And the @Jpf.Forward annotation defines what happens next in the flow. This annotation is similar to the information in the Struts configuration files.

The HelloWorld JavaServer Pages (JSP) file referred to in the forward annotation isn't shown in this article. For purposes of this example, it can be any JSP file with a single line of code to print HelloWorld on the screen.

The NetUI technologies also include three tag libraries, the basic functionality of which is to simplify JSP file development and provide automatic data binding between the view and controller layers. These tags come with JavaScript support, so you can work with them like you would with the standard HTML tags (such as input and select).

This tag library contains tags similar to the struts-html tag.
The NetUI-data tag library is used to bind data from forms and the controller to the JSP file. It allows you to quickly display lists of data, such as search results.
You use the NetUI-template tag library to create subsections (or templates) from your JSP files.

See Resources for more information about the NetUI tag libraries.


Controls are an interesting technology. A control provides a nice layer of abstraction and encapsulation for SOA-based development. Controls are pieces of business logic wrapped up in Enterprise JavaBeans (EJBs) or message-driven beans. They provide a common client interface to any set of resources -- databases, external systems, and others. You can also drag and drop controls into a Java application or Web service to provide the application or Web service with that functionality. They help speed up the development process.

Like the rest of Apache Beehive, controls use JSR 175 annotations heavily. Controls reduce the complexity and learning curve associated with acting as a client of J2EE resources by providing a unified client model that allows access to diverse types of resources.

Listing 2 shows a HelloWorld Java control.

Listing 2. HelloWorld Java control
import org.apache.beehive.controls.api.bean.*;
public interface HelloWorld {
    String sayHelloWorld ();

In this example, I define a simple ControlInterface. If you remove the @ControlInterface annotation, you are left with a simple Java interface class. Listing 3 shows the control implementation for the HelloWorld control interface.

Listing 3. HelloWorld Java control implementation
import org.apache.beehive.controls.api.bean.*;

public class HelloImpl implements HelloWorld {
    public String sayHelloWorld ()  {
        return "hello!";

The code in this listing is pretty simple, right? Now, let's build a Web service out of this example.

Web services using JSR 181

JSR 181 is a metadata standard for Web services based on the JSR 171 annotations standards. Apache Beehive uses JSR 181 to define a set of annotations you can use to expose any Java class as a Web service. The idea behind Beehive Web service development is that the developer writes a simple Java class, then exposes the functionality as a Web service.

Listing 4 shows a simple HelloWorld Web service.

Listing 4. Simple HelloWorld Web service
import javax.jws.WebService;
import javax.jws.WebMethod;

    targetNamespace="targetNamespace = 

public class HelloWorld {
    public String sayHelloWorld() {        
        return "Hello world!";

In this listing, if you remove the elements in bold, you're left with a simple Java class. Using the @WebService and the @WebMethod annotations, I've exposed this simple Java class as a Web service.

Now, with the Apache Beehive technology basics out of the way, you can better understand how you can start using Apache Beehive on your projects.

Using Eclipse to build Beehive applications

The Eclipse Pollinate project is the only integrated development environment (IDE) today that supports Apache Beehive development. This limitation is bound to change in the future as Apache Beehive gains more momentum. Basically, Pollinate is a plug-in to Eclipse that supports the Beehive framework. A combination of the Eclipse IDE and Pollinate with a server such as Apache Tomcat makes a perfect environment for fast and easy Beehive application development.

Getting started with Pollinate

If you don't have Eclipse on your machine, download and install that first. To install Pollinate from Eclipse, launch the Eclipse IDE, then:

  1. Select Help > Software Updates > Find and Install.
  2. In the Install/Update window, select Search for new features to install.
  3. In the next window, click New Remote Site.
  4. In the New Update Site window, enter Pollinate and the URL
  5. Expand Pollinate in the tree, then select the Integration Builds checkbox.
  6. In the next window, select the Eclipse Pollinate Tools checkbox and complete the installation.

After installing the Pollinate plug-in successfully, you can create a new Beehive project. To do so, in Eclipse, select File > New > Other to launch the New Wizard, then select Pollinate > Web Application.

Of course, you also need to download and install Apache Beehive.


The Apache Beehive project seems to be gaining a lot of momentum. BEA Systems made a wise decision to release this core set of technologies to the open source community, and doing so will help in the overall maturity of these technologies, as well as in their adoption. Initially, these technologies were only supported on the BEA WebLogic platform. However, with the release to open source, you should now be able to leverage them on the IBM® WebSphere® Application Server, as well as on other application servers. You can also use Eclipse-based IBM Rational® tools like IBM Rational Software Architect and IBM Rational Software Modeler to design and develop Beehive applications.





Get products and technologies


  • The Eclipse Platform newsgroups should be your first stop to discuss questions regarding Eclipse. (Selecting this will launch your default Usenet news reader application and open eclipse.platform.)
  • The Eclipse newsgroups has many resources for people interested in using and extending Eclipse.
  • Participate in developerWorks blogs and get involved in the developerWorks community.


developerWorks: Sign in

Required fields are indicated with an asterisk (*).

Need an IBM ID?
Forgot your IBM ID?

Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.


All information submitted is secure.

Dig deeper into Open source on developerWorks

Zone=Open source, Java technology
ArticleTitle=The buzz about Apache Beehive