The Advantages of the Java EE 5 Platform: A Conversation with Distinguished Engineer Bill Shannon

By Janice J. Heiss, March 2006  

Articles Index

Version 5 of the Java Platform, Enterprise Edition (Java EE, formerly referred to as J2EE), has arrived. Its streamlined features offer added convenience, improved performance, and reduced development time, all of which enable developers to bring products to market faster.

To get an update on the Java EE 5 platform, we met with Java EE specification lead Bill Shannon, a Distinguished Engineer at Sun Microsystems. Shannon has been with Sun since 1982 and previously worked on the JavaMail API, the HotJava Views product, the Common Desktop Environment (CDE), the Solaris Operating Environment, and all versions of SunOS. He graduated from Case Western Reserve University with an MS in Computer Engineering.

question Can you give developers some specific ways that Java EE 5 will reduce the amount of code they need to write?

answer There are so many ways we've made life simpler for developers, it's hard to know where to start. To some extent, the amount of improvement you'll see is based on the tools you use.

I think one of the biggest improvements is that, in most cases, you no longer need to use deployment descriptors. Even something as simple as combining modules together into an "ear" file used to require a deployment descriptor to list where the modules were. Now all you need to do is to put the modules in the ear file in an obvious way, follow some simple conventions like putting all your shared libraries in the "lib" directory, and that's it.

Here's a simple programming example. Previously, to create a web service, you needed to write a Java interface that describes the web service API, a Java class that implements the web service, a deployment descriptor that tells the container about the web service, and a configuration file that tells the web service runtime how to map Java classes to web service operations. Much of this was boilerplate that changed little from application to application. In Java EE 5 all of this can be done by writing a single Java source file -- the class that implements the web service. The rest is taken care of for you by the container, based on annotations you include in your source code, and based on default rules for what to do when no annotations are present.

Here's the complete source code for a simple web service:

package endpoint;

        import javax.jws.WebService;

        public class Hello {

                public String sayHello(String param) {
                        return "Hello " + param;
Time Saved
"There are so many ways we've made life simpler for developers, it's hard to know where to start."
Bill Shannon
Distinguished Engineer, Sun Microsystems

question Can you estimate how much time a developer would save in developing an enterprise application with Java EE 5 compared with J2EE 1.4?

answer Of course that's difficult to measure and depends a lot on the type of application you're developing. For a relatively simple app, the time to develop the application may be proportional to the number of lines of code in the app. For simple apps, we've probably reduced the number of lines of code you need by half. And if you factor in the reduction in the number of concepts you need to understand in order to write such apps, the time to develop the application is even less. For larger enterprise class apps, the bulk of the application is likely to be the actual business logic of the app, and the reduction in lines of code won't be as great. But the reduction in the number of concepts you need to learn will help, and the overall simplification will reduce the drudgery of creating such an app. You really can focus all your attention on your business logic.

question Take us through the importance of annotations in Java EE 5.

answer Java EE has always promoted a declarative approach for many aspects of enterprise application development. Without support in the Java language for this style of programming, we used external files -- deployment descriptors -- to hold this declarative information. The use of annotations allows us to move this information into the source code, which is where it belongs in most cases.

So, instead of calling an API to request the container to do something for you, and instead of writing a deployment descriptor that has to be synchronized with the code you're writing, you can put your request for the container right in the code. You can say "please expose this class as a web service" or "please start a transaction when this method is called".

"If you were scared off of J2EE because it seemed too complex, it's time to take another look."
Bill Shannon
Distinguished Engineer, Sun Microsystems

Of course, this new capability in no way removes or interferes with older capabilities. There are cases in which a deployment descriptor is the right approach, and you can continue to use them when desired.

question If you could speak to an audience of 1000 talented developers who were on the fence, and considering moving to Java EE 5, what would you say to them?

answer This is not your father's J2EE!

If you were scared off of J2EE because it seemed too complex, it's time to take another look. If you've been attracted to alternative technologies such as Spring and Hibernate, you'll find many of the good ideas from those technologies in Java EE 5.

Take a look at Java EE 5, you'll be amazed at how easy it is.

Try It Out!
Get started with the Java EE 5 platform preview:
Enterprise JavaBeans 3.0 and the Java Persistence API

question Tell us how the EJB programming model has been simplified in EJB 3.0. How does the use of Plain Old Java Objects (POJOs) in EJB 3.0 make programming easier?

answer First, it's important to understand that the thing people have been calling "EJB 3.0" is really two separate things. The core of EJB 3.0 is a great simplification of the classic EJB programming model. But probably the most exciting work done by the EJB expert group is the new Java Persistence API.

Java Persistence is in many ways a replacement for EJB CMP (Container Manager Persistence), although CMP is still fully supported. Java Persistence is a much simpler approach to mapping Java objects to relational databases, and benefits greatly from work done in other products and technologies such as Hibernate, TopLink, and Java Data Objects (JDO). The lessons we've learned from them, and from years of using EJB CMP, led us to create Java Persistence. Java Persistence is a significant departure from EJB CMP, and more resembles those other technologies. Java Persistence is based on POJOs with annotations. Java Persistence is available both as part of Java EE, and for use outside Java EE in a Java SE environment.

In addition, we've greatly simplified the basic EJB programming model. It is much easier to write a stateless or stateful component that takes full advantage of the transactional capabilities of the EJB container. EJB components can be written as POJOs with, for example, a simple @Stateless annotation. By default, the public methods of the component will be exposed to clients and will run in a transaction. Additional annotations can be used to control security requirements for methods and transaction requirements.

JavaServer Faces and Web Application Design

question How does the addition of JavaServer Faces (JSF) make web application design more convenient?

answer JSF makes web application development more convenient both in the ease with which you can write web application code, and in the code that you never have to write at all.

There is a large third-party component market for JSF, which means the developer has the option to leverage high quality commercial off-the-shelf components in their application. JSF is a Java Community Process (JCP) standard that already has broad adoption from major vendors such as IBM, Oracle, BEA, JBoss, and Borland. With such market penetration, you can be sure that your investment in JSF will be preserved.

The technical convenience of JSF stems from its component model, which allows page authors to compose their user-interface at a higher level of abstraction than previous technologies. JSF presents a Swing-like event model for web applications that works very well with tools.

Lastly, JSF is very adaptable and extensible. Existing popular technologies such as Spring and Hibernate have included JSF adapters to allow their use with JSF. Naturally, because JSF is a part of Java EE 5, it integrates very well with Java Persistence and EJB 3.0.

Java EE 5 and Service-Oriented Architecture

question Let's talk about Service-Oriented Architecture (SOA), which is regarded by many as the next big thing. Java EE 5 includes simplified web services support and the latest web services APIs, making it an ideal implementation platform for SOA. Tell us about this.

answer The web services support in Java EE 5 is based on the JAX-WS (Java API for XML Web Services) and JAXB (Java API for XML Binding) APIs, and the web services metadata support defined by JSR 181.

JAX-WS is mostly based on JAX-RPC (Java API for XML-based Remote Procedure Calls), but has been improved to better support the latest web service standards and programming styles.

JAXB 2.0 is a significant improvement over JAXB 1.0, which adds full support for W3C XML schemas. JAXB is used to map Java classes to XML data and is used by JAX-WS to encode and decode data that is sent in web services calls.

Once again, the use of annotations makes it much easier to create and use web services. JSR 181 defines the annotations that are used with JAX-WS to define web services. In the simplest case a POJO is annotated with the @WebService annotation to make it a web service, as I previously described. JAXB also uses annotations to control the mapping to XML. Both JAX-WS and JAXB provide useful defaults so that it's often not necessary to use most of the annotations they provide. The simple cases "just work" and the more complex cases are made easy through the use of annotations.

question Why should a developer who has never before used Java technology try Java EE 5?

answer The many improvements in Java EE 5 make it much more user-friendly for first-time Java developers, most of whom will want to start with an integrated development environment such as NetBeans or Sun Java Studio Creator. The IDE can help take you through the steps of creating a Java EE application. You'll find that many applications can easily be created without detailed knowledge of Java programming. As we talked about earlier, JSF is a key to creating simple web user interfaces using off-the-shelf components.

But an IDE is not necessary to create Java EE applications. Some first time Java EE developers might prefer to start by writing simple JSP pages, making use of the JSP expression language, and never need to learn the Java language at all.

question What should developers understand about the Sun Java System Application Server PE 9.0?

answer The Sun Java System Application Server, Platform Edition 9.0 -- that's a mouthful! -- is Sun's product version of the GlassFish code that serves as the reference implementation for Java EE 5. The PE application server is suitable for development and small scale deployment. Sun will also make available an EE (Enterprise Edition) version of the application server that will include more advanced features such as five nines availability.

The PE application server, built from the GlassFish code, is the application server included in the Java EE 5 SDK, as well as our development tools such as NetBeans and Java Studio Creator.

The Importance of GlassFish

question What is the significance of Glassfish and the open source community? And what should the open source community understand about Java EE 5?

answer The GlassFish community is building a free, open source application server that implements all of Java EE 5. GlassFish includes both Sun and non-Sun contributors. For instance, the Java Persistence implementation in GlassFish is contributed by Oracle. GlassFish really is a community effort. If you're interested in helping to build the reference implementation of the Java EE spec, GlassFish is the place to be.

"If you're interested in helping to build the reference implementation of the Java EE spec, GlassFish is the place to be."
Bill Shannon
Distinguished Engineer, Sun Microsystems

GlassFish is free, and it is open source. I repeat: GlassFish is free, and it is open source. GlassFish uses the OSI-certified CDDL license.

question How can developers contribute to the future of Java EE?

answer There are many ways to contribute to the future of Java EE 5. Perhaps the best approach is to go to the Java EE hub page, read the tutorial, download the SDK, try it out, and send us feedback!

Developers who are interested in understanding "how it all works" will definitely want to explore GlassFish.

The GlassFish site also includes tips and examples that will be useful to developers. Developers who want to get involved in contributing to the GlassFish project will find instructions there.

Finally, developers who want to contribute directly to the development of future Java EE specs should become JCP members, review draft specs, and consider participating in future expert groups to develop specs.

question If you were pressed to name the single most important thing to know about Java EE 5, what would it be?

answer It's hard to name just one thing. Certainly the thing that pervades all of Java EE 5 and is key to the simplified programming model is annotations. We've used annotations to make it much easier to deal with persistence, web services, transactions, security, and all the other powerful capabilities of Java EE. We expect that developers will quickly understand and embrace the annotation approach to application development and will then move on to explore the improved persistence and web service capabilities in Java EE 5.

See Also
Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.