Antonio Goncalves is a senior software architect living in Paris. Initially focused on Java development since the late 1990s, his career has taken him to different countries and companies where he works now as a Java EE consultant in software architecture. As a former BEA consultant he has a great expertise in application servers such as Weblogic, JBoss and, of course, GlassFish. He is particularly fond of Open Source and is a member of the OOSGTP (Open Source Get Together Paris). He is also the co-creator of the Paris Java User Group and talks on Les Cast Codeurs podcast. Antonio wrote a first book in French on Java EE 5 back in 2007. Since then he has join the JCP and is an Expert Member of various JSRs (Java EE 6, JPA 2.0 and EJB 3.1). He then published a second book for Apress: Beginning Java EE 6 Platform with GlassFish 3. For the last years Antonio has been talking at international conferences mainly about Java EE, including JavaOne, The Server Side Symposium, Devoxx, Jazoon… He has also written numerous technical papers and articles for IT Web sites (DevX, JaxEnter) or IT magazines (Programmez, Linux Magazine). Antonio is a DZone MVB and is not an employee of DZone and has posted 26 posts at DZone. You can read more from them at their website. View Full User Profile

Yet Another Petstore!

07.02.2012
| 3470 views |
  • submit to reddit

Do you remember the good old Java Petstore ? It was a sample application created by Sun for its Java BluePrints program. The Java Petstore was designed to illustrate how J2EE (and then Java EE) could be used to develop an eCommerce web application. Yes, the point of the Petstore is to sell pets online.

The Petstore had a huge momentum and we started to see plenty of Petstore-like applications flourish (the idea was to build an entire application with a certain technology). But let’s face it, the J2EE version was far too complex and was using plenty of (today outdated) design patterns. When I wrote my Java EE 5 book back in 2006 (sorry, it’s written in French), I decided to write a Petstore-like application in Java EE 5 but much simpler. But again, it’s out-dated today.

Later on I wrote a book about Java EE 6and felt there was a need to have an updated Petstore so we could discover new patterns and APIs. Unfortunately Sun/Oracle didn’t do it… so I’ve decided to do it myself (with some help from my friends Antoine Sabot-DurandBrice Leporini, Hervé Le Morvan). I’ve updated my YAPS Petstore to follow Java EE 6 and all its goodies (CDI, EJB Lite, REST interface, Bean Validation).

The goals of this sample is to :

  • use Java EE 6 and just Java EE 6 : no external framework or dependency (I even use java.util.logging API ;o)
  • make it simple : no complex business algorithm, but I use most of the Java EE 6 APIs, the point is to bring Java EE 6 technologies together to create an eCommerce website

If you want to use a different web interface (PrimeFaces, pure HTML, Android…), external frameworks, add some sexy alternative JVM language… feel free to fork the code and do so. But I won’t do it because I want this EE 6 Petstore to remain simple and to stick to Java EE 6.


The only external frameworks that I’ve used are Twitter Bootstrap (so my JSF pages don’t look too ugly) and Arquillian for integration testing. My goal is to be able to deploy this Yaps Petstore on different application servers. For now it’s mostly GlassFish, JBoss but some work is also happening on TomEE and I’ll try to port it later on Resin, Weblogic, Websphere…. and who knows, do some performance benchmark of the same application but on different servers.

My next task is to deploy this Yaps Petstore on CloudBees… stay tuned. In the meantime, give it a try and let me know what you think.

Published at DZone with permission of Antonio Goncalves, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: