David Heffelfinger on Java EE 5 and GlassFish
David Heffelfinger on Java EE 5 and GlassFish
Join the DZone community and get the full member experience.Join For Free
[img_assist|nid=2506|title=|desc=|link=none|align=left|width=83|height=100] 1. David, tell us something about yourself. Who you are, where you are located, and what kind of work do you do?
I have always been very enthusiastic about computers and technology in general. I got started in software development writing simple BASIC programs as a teenager when my uncle gave an Atari 800 personal computer as a present (with a whopping 48 kilobytes of RAM!) back in the '80's. Since I enjoyed programming my Atari so much, it wasn't hard at all for me to decide that I wanted to major in computer science when I went to college.
I have been developing software professionally since 1995, I started working with Java in 1996, with JDK 1.0.2. I am also a Linux user, I have used several Linux distributions over the years, I am currently using Ubuntu.
After nearly 13 years of working for large corporations, I recently started my own consulting firm, Ensode Technology, LLC (http://www.ensode.com), based just outside of Washington, DC. My current main project is a large scale J2EE application for a big government client. I also periodically work as a Java EE 5 instructor and I am writing another book. With whatever time I have left I also maintain a web site covering primarily Java technologies and APIs at http://www.ensode.net.
2. How did you get involved in writing this book?
I had already written a book for Packt Publishing before (Jasper Reports for Java Developers), Packt was considering getting a book on GlassFish out, they contacted me to see if I was interested in the project.
3. Who is the target audience?
There are two primary target audiences: developers who are familiar with Java, but have no experience with J2EE or Java EE, and developers who are familiar with J2EE and would like to learn more about Java EE.
4. What are the specific features you cover in detail?
The book covers all major Java EE APIs including JSF, EJB 3, JPA, JAX-WS, JMS, Security, JSP's, JSTL, servlets, JDBC, additionally there is a chapter covering technologies that built on top of the Java EE 5 specification such as Facelets, Ajax4jsf and Seam.
5. There are so many books on Java EE 5, tell us something which is different in this book?
Quite frankly I haven't read much of the competition, except the Java EE 5 Tutorial from Sun, therefore I can't give a straight comparison. However I believe this is the only book that covers GlassFish specifically.
For the most part, Java EE 5 is application server independent, applications that conform to the specification should be deployable on any compliant application server, however, the configuration of the application server may vary greatly between application servers. The book covers how to configure JDBC connection pools, data sources, JMS Queues and Topics, JavaMail sessions, security realms and such in GlassFish. Having said that, I would like to clarify that the book is primarily a book on development, and all configuration material is there to support the software development topics.
One more thing that is covered that books not targeting GlassFish directly is the ability to test web services without having to code any web service clients. GlassFish can generate a web service client "on the fly" by simply clicking a "Test" button on its web console after deploying a web service.
Additionally, there are certain areas that the Java EE 5 specification doesn't cover, and each application server implements in their own way, for example, if we need to override the default context root for a web application deployed as a stand alone WAR file, the procedure is different for each application server, the book explains how to do this in GlassFish by modifying the GlassFish specific sun-web.xml deployment descriptor.
One area that I noticed was under documented was the ability to develop custom security realms and deploy them in GlassFish. I had to dig deep into GlassFish and examine its source code to be able to understand how to do this. I believe developers that need this functionality will greatly benefit from this information.
6. Java EE and GlassFish is a perfect match, tell us more about these two?
GlassFish is the reference implementation for Java EE, therefore any new Java EE features more than likely will be implemented in GlassFish before (many times long before, as evidenced by the fact that there are still some application servers that aren't 100% Java EE 5 compliant, even though the specification has been out for almost two years) they are implemented in other application servers.
In addition to being the reference implementation, GlassFish is very robust and production ready, therefore it can safely be used in production systems, as evidenced by several GlassFish adoption stories at http://blogs.sun.com/stories/.
Although there is no reason not to use GlassFish in production systems, we as developers don't always control the application server our employers or clients use, therefore it is reassuring to know that applications deployed to GlassFish can be easily deployed to other Java EE 5 compliant application servers, because of this we are able to "get our feet wet" with Java EE 5 by using GlassFish on personal projects, and the knowledge obtained is transferable to whatever application server our employers or clients use.
7. What feature do you like to see the most in the next version of Java EE 5?
One feature that I really liked about Java EE 5 was the use of annotations for configuration, greatly reducing the need for XML deployment descriptors. I would like to take this feature further, to have the ability to configure JSF managed beans using annotations as opposed to declaring them in faces-config.xml.
Another thing I liked about Java EE 5, specifically EJB 3, is that the number of artifacts needed to develop EJBs was greatly reduced, as opposed to having up to 4 interfaces (local, remote, local home, remote home), 2 deployment descriptors (ejb-jar.xml and an application server specific deployment descriptor) and a Java class, we now need only the Java class and one or two business interfaces (remote and/or local). I would like the ability to take this even further, removing the need for the remote and/or local interfaces.
The good news is that both of the above features are planned for Java EE 6.
8. Are you using EJB3 at work?
My primary project does not use EJB 3 since my client is using an application server that is not yet Java EE 5 compliant, however I have used EJB 3 and Java EE 5 in several secondary projects.
9. What can you tell us about your experience with Java EE 5?
Compared with J2EE, Java EE 5 is a joy to use. Like I mentioned before, the number of artifacts necessary to develop Java EE 5 applications is much lower than what is necessary with J2EE. Additionally, it is almost never necessary to do a JNDI lookup with Java EE 5, instead dependency injection can be used. Because of these two facts, Java EE 5 applications involve a lot less of boilerplate code, making them a lot easier to maintain and develop than their J2EE counterparts.
10. Any tips for our readers who are using other open source Application Server to move to GlassFish?
If your application is Java EE 5 compliant, it should work in GlassFish without any coding changes. The only thing needed would be to configure any necessary resources such as connection pools, JavaMail sessions, security realms and such, and the application should "just work". However, any application server specific configuration files will need to be migrated to their GlassFish equivalents. The good news is that there is a GlassFish migration tool that automates this process for several popular application servers, it can be obtained at https://migrate2glassfish.dev.java.net/.
As a concluding remark, I would like to thank Meera and DZone for the opportunity to talk about my book, GlassFish, and Java EE. I visit DZone every day to keep abreast of what is going on in the technology world and I was thrilled about having the opportunity to be interviewed by the site.
I would also like to mention that Packt Publishing will be giving away two free review copies of the book. The first two people to contact me at firstname.lastname@example.org expressing an interest in doing a review will get a copy each.
Opinions expressed by DZone contributors are their own.