Miles to go …

July 6, 2010

QA#3: Java EE 6: Jigsaw puzzle, Modular, standard, less xml, easy, easy – by Antonio Goncalves

Filed under: General — arungupta @ 11:27 pm

This blog entry is third (previous ones) in the Java EE 6 feedback from the community series. You can learn about how Java EE 6 is currently being used in production, development and deployment environments used within the community, and even feature requests for Java EE 7.

This entry comes from Antonio Goncalves – a senior software architect specialized in Java / Java EE working as a consultant. He started working with Java in 1998 and quickly with J2EE in 1999. He published a first book (in French) about Java EE 5 in 2007 and became a JCP Expert Member of various JSRs in 2008 (Java EE 6, JPA 2.0 and EJB 3.1). He is a member of the OSSGTP (Open Source Solution Get Together Paris), co-leader of the Paris JUG and has been awarded Java Champion. Follow him on Twitter (http://twitter.com/agoncal) and read his blog (http://agoncal.wordpress.com/).

Here is a short summary of Java EE 6 from him:

Jigsaw puzzle, Modular, standard, less xml, easy, easy, have I said easy?

Read on for other fun stuff …

1. How are you using Java EE 6 today? What limits your adoption ?

The first use case of using with Java EE 6 is to develop anything I need to develop, any prototype.

  • Need to write a quick task processing a database? Java EE 6.
  • Need to develop a quick admin site with a few pages interacting with an LDAP directory? Java EE 6.
  • Need to expose a RESTful web service? Java EE 6.

The platform became so integrated, as well as being so modular, and so simple to use, that any simple use case is a perfect excuse to use Java EE 6 (take a transactional EJB 3.1, a few JPA 2.0 entities, package everything in a war, no interfaces, no XML, and you are done).

The second use case is to use some bits of Java EE 6 as a jigsaw puzzle at my customers. The beauty of EE 6 is that most specifications can be used separately. At the moment I’m using Bean Validation and JPA 2.0 under Tomcat, no need to use the full platform not to deploy it to a full compliant application server.

In my case, Spring is limiting a wider adoption of Java EE 6. Only very recently Spring Web Flow has started to support bits of JSF 2.0. The day it fully supports it, I will be able to add a few extra specs in my applications.

Another technological limitation is the limited number of containers that implement Servlet 3.0 and EJB 3.1. Today, only GlassFish and Resin implement the Web Profile (and the full profile for GlassFish). But JSF 2.0 can run on Servlet 2.5 (i.e Tomcat 6.x).

2. What Java EE 6 technologies are you using and why ?

In fact, if the question was "What Java EE 6 technologies are you NOT using and why?" I would have answered Servlet 3.0 and EJB 3.1 because they need containers (even if EJB 3.1 has an embeddable container that goes with it) and as I said, there is still a lack of containers implementing them. The rest of Java EE 6 can be used on a per-specification basis. At my customers I use any piece of Java EE 6 that I can. Bean Validation 1.0 and JPA 2.0 are so easy and well integrated that I use them as much as I can. The integration between Bean Validation and JSF 2.0 is also very handy. JAX-RS is a fantastic RESTful web services API that you can use with Servlet 2.5 containers such as Tomcat 6.x. I’m not even talking about JMS, JAX-WS and JTA that I use on a day to day basis.

3. What is your development and deployment environment?

I am an IntelliJ Idea addict. I gave up trying to figure out how Eclipse tries to work and which plugins to install (sorry, it’s not called plugins now but OSGI bundles, the ones you start and stop at runtime… what a joke). Once in a while I use NetBeans, but the Java EE 6 support with Intellij is really amazing. And then, I really have two different kinds of usages: GlassFish, H2 and MySQL and at my customers it’s more Tomact, WebLogic, Websphere (unfortunately) and Oracle. Even if I have lots of complaints about Maven, I use it everywhere so I can be IDE-agnostic when I need to build my projects.

4. What previous versions of Java EE / J2EE have you used ? How has the migration to Java EE 6 benefited ?

Being a former BEA employee from 1999 and 2001, I can say that I’ve used all versions of the Java EE platform (from J2EE 1.2). The early versions being a very painful experience. I did a lot of Entity Beans CMP and it was a real nightmare. I remember the very first EJBs when the deployment descriptor was serialized and then it became XML files. Migrating from Entity CMPs to JPA was not easy as you had to go to your customer and say "sorry, we lied to you, Entity Beans CMP are not great and guess what? you need to throw your code to the bin and start with a fresh JPA 1.0 domain model". Like everybody I moved to Struts, Hibernate and Spring. But I quickly realized that I wasn’t an XML fan and found Spring was becoming too complex and messy for my needs. Since Java EE 5 development on server side has been simplified with convention over configuration with containers doing most of the work. Migration and portability has improved, I often work with customers who develop Java EE 5 application on one application server and deploy it in another. Java EE 6 goes even further in terms of portability.

5. Describe the benefits of Java EE 6 to you in 120 characters.

Jigsaw puzzle, Modular, standard, less xml, easy, easy, have I said easy?

6. Advice for anybody who is looking at Java EE 6 for their next project ?

Well, first of all you should buy my book ;o) (http://apress.com/book/view/1430219548) Java EE 6 is modular; don’t see it as a blob. Take the bits and pieces that you need. Start with JPA 2.0 and Bean Validation, that’s easy. If you can, add JSF 2.0 that will simplify configuration, resources management and component development. Take JAX-RS if you do RESTful applications. For injection, and many more, use Weld (the CDI implementation) that runs also on Tomcat. If you do Spring 3.x, think of using @Inject (unfortunately Spring doesn’t implement CDI). If you then can use GlassFish or Resin, these are the two implementations ready to execute your EJBs 3.1 (JBoss 6 is on the way). Because Java EE 6 is so simple, don’t over engineer your code: interfaces are not always needed; DAOs are not always needed either… KISS and refactor your code later if you really need it.

The final word is, add Java EE 6 specification to your project in an incremental way. When you can get rid of a proprietary framework and change it to a standard one, do so. You will avoid "vendor locking" (or "open source framework locking", as open source is different from open standard). And use design patterns when you really need them.

7. What new features you’d like to see in Java EE 7 ?

What I really miss in Java EE 6 is something similar to Spring Web Flow or Seam Page Flow. I hope that in Java EE 7 a new specification will come and standardize flow management (for JSF, of course, but something more general letting you manage different sorts of flows).

Batch processing is also something missing. Spring Batch is very good and defines well known principals such as jobs, steps an
d so one. With EJB 3.1 there is a new Timer Service (inspired from cron and as rich as Quartz). It’s time to get a Batch processing specification that can be easily scheduled.

Security is also a difficult point. JAAS is too low level. Even if there are some improvements in the Servlet 3.0 API, there is still room to tight the platform together in terms of security.

Packaging could also be changed in Java EE 7. We talk a lot about OSGi these days. As a developer I found it too difficult, I would like the EE 7 platform to simplify the creation of bundles (OSGi or something different but compatible). I’m also hoping that Java SE 7 will become more modular. Modularity in Java SE 7 + OSGi packaging in EE 7 would be a great combination.

And I remember talking to Adam Bien about it, JMS hasn’t changed for more than a decade, it should benefit from the novelties of the platform and get simpler.

In a word, I would like Java EE 7 to get richer (more specs), simpler (less code to write) and more integrated (security is one example).

Are you using, consulting, training, authoring books, etc in Java EE 6 ? Drop a comment on this blog and I’ll line you up for the Q&A session :-)

The Java EE 6 hub is your key resource to learn all about the technology.

And you can always try all Java EE 6 features in GlassFish.

Technorati: javaee6 community feedback antoniogoncalves glassfish v3

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
Related posts:
  1. QA#2: Java EE 6: Integrated specifications, simple and annotation driven, next level of industry standard – by Markus Eisele
  2. Java EE 6 specifications approved by JCP – GlassFish v3 & TCK coming soon!
  3. TOTD #129: Managed Beans 1.0 in Java EE 6 – What and How ?
  4. QA#7: Java EE 6: Scripting framework like productivity based on standards – by Paul Bakker
  5. QA#9: Java EE 6: XML-less, annotated POJO, light app servers, EJB-in-a-WAR – by Yakov Fain

1 Comment »

  1. You really saved my skin with this inomfration. Thanks!

    Comment by Kaylie — July 6, 2011 @ 1:12 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Powered by WordPress