Tuesday Jan 20, 2015

Heads Up on Java EE @ DevNexus 2015!

DevNexus 2015 will be held on March 10-12 in Atlanta. If you are a US based developer and do not know about DevNexus, you are definitely missing out. DevNexus was started a few years ago as an initiative by the Atlanta Java User Group (now one of the largest Java user groups in the world) and Burr Sutter (one of the earliest Java champions). Since then DevNexus has grown to become one of the largest Java leaning conferences in the US, perhaps second only to JavaOne. I've spoken at the conference a few times over the years. This year's roster is unsurprisingly impressive both in terms of speakers and content. Java EE has a strong showing including a few talks from me.

Below are the talks that might interest you if you are a Java EE fan (the schedule is not quite final yet so do stay tuned to the conference agenda for changes):

  • Down and Dirty with Java EE 7: This is essentially our flagship lab/workshop at the moment covering Java EE 7. It has always proven popular so far and it is a great way to get some hands-on experience with Java EE 7. The materials for the lab is always available here. The lab is largely intended to be self-guided so you should be able to take advantage of the material even if you can't attend the lab in person. This will be my first talk at the conference.
  • JMS.Next(): JMS 2.0 and Beyond: This is essentially an overview of JMS 2 (already in Java EE 7), with a bit of an early preview of JMS 2.1 (to be included in Java EE 8). The slides for the talk are available here. This will be my second talk at the conference.
  • Java Persistence API: This session is a good mix of the basics, best practices and real world adoption stories for JPA. It's a talk by Jason Porter. Jason is a good speaker, a long time Java EE advocate and a Red Hat engineer.
  • HTTP 2.0 comes to Java. What Servlet 4.0 means to you: This session will discuss what's in HTTP 2 and what that means for the next major revision of the foundational Servlet specification. I would say this is a must-attend for all server-side Java developers. My friend, colleague and Servlet specification lead Ed Burns is giving this talk. Ed is a brilliant speaker that's always a pleasure to listen to.
  • Java EE 8: A Community Update: This is essentially a high level overview of what's coming in Java EE 8. This should be my last talk at the conference. Besides covering the current state of Java EE 8 I will also talk about how you can get involved in the process including through highly inclusive programs like Adopt-a-JSR. The slides for the talk are here.

Hope to see you at the conference? Besides giving my talks I will be attending a few talks myself as time allows. As always never hesitate to stop me if there is something I can help with. I'll also bring along some Java/Java EE goodies you are welcome to.

Friday Jan 16, 2015

File Uploads Using JSF 2.2 and Java EE 7

File uploads have long been possible in JSF, usually using third party plugins like PrimeFaces or RichFaces. JSF 2.2 finally adds support for file uploads out of the box. The practical reason for this lag is that the JSF specification has always chosen to support a Servlet version one behind the latest. This is what often makes it possible to use newer versions of JSF on older runtimes, particularly on Servlet containers like Tomcat. Consequently JSF 2.2 can depend on Servlet 3.0 which adds support for multi-part file handling - making the new file upload feature possible. In a pretty well written code driven post, Hantsy Bai explains the file upload support in JSF 2.2/Java EE 7. You can also check out Rama Krishnnan's YouTube video below on the file upload feature:

Interestingly Rama uses Tomcat and an older version of NetBeans but is still able to demo the feature well (he also chooses to do manual header parsing himself). Things are obviously a lot easier with a Java EE 7 server like GlassFish, which is what Hantsy Bai uses instead.

Monday Jan 05, 2015

Vasilis Souvatzis's Java EE 7 Thesis Using GlassFish

Hoping all of our readers happiness, health and wealth in this first post of the year! It's an awesome stroke of good luck to be able to start the year off by sharing a pretty cool Java EE 7/GlassFish 4.1 adoption/learning story. Vasilis Souvatzis, a computer science student at the Alexander Technological Educational Institute of Thessaloniki (ATEITHE) in Greece, decided to do his thesis project on Java EE 7. He basically taught himself Java EE 7, Java SE 8, GlassFish, NetBeans and PrimeFaces with little more than what is freely available online. He is now proudly a fan of the technology stack, particularly Java EE 7.

The end result of his project is a pretty sophisticated, non-trivial working code base simulating a web-based tutorial (there aren't too many students that I know of that has those bragging rights :-)). He actually made the project available on GitHub for all to see. He demos the project in the video below he took the time to create:

The GitHub project has instructions on how to setup and explore the project yourself. He would also welcome any contributions if you are so inclined. Enjoy and don't forget to spread the word on Vasilis's hard work useful to the Java EE community if you think it is cool!

Thursday Dec 11, 2014

Named and Dynamic Binding in JAX-RS 2

Providers, interceptors and filters are excellent mechanisms to bring pluggability and cross-cutting concerns to JAX-RS. By default these artifacts are applied globally to all available JAX-RS resource methods. This is probably fine for the most part but in some cases it's useful to have a bit more control over where filters and interceptors are applied. Fortunately, JAX-RS 2 has two mechanisms to facilitate this - named and dynamic bindings. Named bindings are much like binding CDI interceptors in that it is declarative and static - you get to choose in a loosely coupled, type-safe fashion where you want a binding to occur but you can't change bindings at runtime. Dynamic bindings as the name implies gives you a much greater degree of flexibility. You can choose at runtime in a completely programmatic fashion where bindings should occur. The trade-off is that dynamic bindings are a bit more complex and verbose. Michal Gajdos explains both named and dynamic JAX-RS 2 provider bindings in a fairly brief but excellent blog post.

Towards the bottom of the post, Michal has links to the Jersey docs that is a great resource for understanding the concepts of providers, interceptors and filters in a general sense.

Thursday Dec 04, 2014

The Java 7 EE Tutorial - free eBook!

The Java EE 7 Documentation page has been recently refreshed with an improved and cleaner layout.   It should now be easier to locate, browse and read the Java EE API documentation, the Java EE SDK documentation and the Java EE Tutorials.

It is sometime useful to remind about the availability of useful resources such the "Java EE Tutorial"… even more when those resources a free!  The Java EE Tutorial is one of those gems that is sometime overlooked.  It covers Java EE 7 and is an invaluable set of resources for anyone wanting to learn Java EE but also for people already familiar with Java EE as it also covers some of the less known part of the Java EE platform such as JCA.

For new comers, there is "Your First Cup: An Introduction to the Java EE Platform", a crisp introduction to the Java EE platform.

The "Java EE 7 Tutorial" is available for free (online and PDF format).  In addition, the Java EE Tutorial is now also available in ePub and Mobi formats (hint: check the top right corner) so you can download and read it on your preferred eBook reader (tablets, iBook, Kindle, etc.).  Just check the top right corner.  And again, those great resources are free!

Finally if you are more old school, the "Java EE 7 Tutorial" is also available, for a fee, as a dead-tree version.

Tuesday Dec 02, 2014

JMS 2.0 Errata release

There is a clear plan to enhance the JMS specification and that is JMS 2.1 (JSR 368), slated for inclusion in Java EE 8.  The JMS 2.1 Expert Group is still in formation phase and once this is done, the EG will start the actual works on the next revision of JMS.  This work is expected to take time, Q3 2016 is the current ETA for the Java EE 8 final release. 

But let's not forget the current version of JMS, i.e. JMS 2.0 (JSR 343).  An errata is needed to correct a few errors in JMS 2.0 which can't wait for JMS 2.1 because they affect the ability of implementers to correctly implement JMS 2.0 today.  An 'errata' is a simple kind of maintenance release intended purely to correct errors in the specification, so clearly the intention is not define any new features (any new features should be discussed within the JMS 2.1 scope).

For that reason, Nigel Deakin (JMS 2.0 and JMS 2.1 Specification Lead) has proposed and started an errata for JMS 2.0.  An Errata release (and maintenance releases in general) don’t have an Expert Group.  Nevertheless Nigel is soliciting feedback on the various small issues that he plans to have addressed in the JMS 2.0 Errata.  You can check the changes proposed for the JMS 2.0 errata on this Wiki page, the jms-spec users mailing list is a good channel to provide feedback.

Monday Dec 01, 2014

Bulk Update/Delete using the Criteria API in JPA 2.1/Java EE 7

It has long been possible to do bulk updates and deletes using JPQL in JPA. Since JPQL is closely modeled after SQL, it has the key advantages that SQL does - namely that it is a very compact and powerful DSL for relational data manipulation. JPQL is also a natural transition mechanism to JPA for folks that have worked with SQL for a while (such as myself).

The big drawback for JPQL is that it is decoupled from the Java compiler and thus less type-safe/more error-prone. This weakness becomes particularly salient while needing to dynamically construct queries at runtime (with JPQL this basically turns into a lot of hard-to-read string manipulation) or with folks coming from a Java/OO background without much preexisting experience with SQL/RDBMS. For these reasons, the type-safe, Java centric Criteria Query API was added to JPA 2.0/Java EE 6.

In JPA 2.1/Java EE 7 the Criteria API has been moved even closer to JPQL with the addition of bulk update and delete capabilities (the Criteria API in JPA 2.0 supported queries which is by far still the primary use case for the API). Hantsy Bai has a very nice post demonstrating how bulk updates/deletes look like using the JPA 2.1 Criteria API.

For a more basic overview of the Criteria API itself, you should check out the official Java EE 7 tutorial.

Tuesday Nov 18, 2014

JavaOne Replay: "Into the Wild with Servlet Async IO"

Greg Wilkins has an impressive 'Web pedigree’; he is the founder and lead developer of Jetty.  Greg is a long-time member of the Servlet Expert Group; he is also a member of the IETF HTTP/2 working group member, etc.!

During his JavaOne session, Greg gave a deep technical overview on Asynchronous IO using the Servlet API.  Greg starts by explaining what asynchronous means in the context of a Servlet. He then goes and explains the Servlet 3.0 asynchronicity support.  The rest of the talk is then spent on the Servlet 3.1 API and how to write effective asynchronous servlets (and how the inner-working of the API).  Greg also shares some of the motivations behind the Servlet 3.1 API and the technical choices behind it. Not only that, Greg is also talking about some 'potential more obvious technical options' and why those options were not selected at the end.

This technical session provides different angles (e.g. Servlet API explanations, some deep technical points such as some of the Jetty implementation details but also best practices advices, etc.).  Overall this session is highly recommended for anyone who want to understand asynchronicity in the context of the Servlet API.


You can find Greg's slides here.

Wednesday Nov 12, 2014

Java EE @ NFJS Pacific Northwest Software Symposium Seattle

As some of you may be aware I recently joined the well-respected US based No Fluff Just Stuff (NFJS) Tour. The NFJS Pacific Northwest Software Symposium was held October 17 - 19 in Seattle, Washington.

I had five talks total over two days, more or less back-to-back. I did talks on Java EE 7/Java EE 8, the Cargo Tracker Java EE Blue Prints, JavaScript + Java EE, Java EE + NoSQL as well as WebSocket. More details, including slide decks and code as well as my NFJS tour schedule, posted on my personal blog.

Monday Nov 03, 2014

Java EE @ NFJS New England Software Symposium Boston

As some of you may be aware I recently joined the well-respected US based No Fluff Just Stuff (NFJS) Tour. The NFJS New England Software Symposium was held September 19 - 21 in Boston. This is one of the larger NFJS shows and attendance at the show and my sessions was pretty good. It is always encouraging to see the same folks attend more than one talk. On my way to the show I also stopped by at the Connecticut Java User Group. The JUG is led by my friend and co-author for EJB 3 in Action Ryan Cuprak. I've spoken at the JUG a number of times over the years and it was good to be back.

I had five talks total over two days, more or less back-to-back. I did talks on Java EE 7/Java EE 8, the Cargo Tracker Java EE Blue Prints, JavaScript + Java EE, Java EE + NoSQL as well as JMS 2. More details, including slide decks and code as well as my NFJS tour schedule, posted on my personal blog.

Wednesday Oct 29, 2014

Java EE @ NFJS Greater Atlanta Software Symposium

As some of you may be aware I recently joined the well-respected US based No Fluff Just Stuff (NFJS) Tour. The NFJS Greater Atlanta Software Symposium was held September 12 - 14.

I had four talks total over two days, more or less back-to-back. I did talks on Java EE 7/Java EE 8, WebSocket, the Cargo Tracker Java EE Blue Prints and JavaScript + Java EE. More details, including slide decks and code as well as my NFJS tour schedule, posted on my personal blog.

Wednesday Oct 22, 2014

Themes/Resource Library Contracts in JSF 2.2/Java EE 7

Resource Library Contracts are one of the big ticket features in JSF 2.2. There's actually quite a bit to the feature - it allows for logical organization and packaging of the theme/look-and-feel/template for JSF pages. Beyond enabling better modularity, the feature makes it possible to switch page themes at runtime (much like PrimeFaces, RichFaces, etc did in the past). Huseyin Akdogan explains the details of resource library contracts in a code-intensive post. You should also checkout the video below from the GlassFish Videos YouTube channel in which specification lead Ed Burns covers the feature along with JSF 2.2 generally (the video is pretty short - just about fifteen minutes).

The official Java EE 7 Tutorial has a decent section on the basics of  resource library contracts as well.

Tuesday Oct 21, 2014

New book: RESTful Java Patterns and Best Practices

RESTful Java Patterns and Best Practices” written by ’Bhakti Mehta' has been recently published. One of the great thing about this book is that it is not a theoretical book covering the JAX-RS API 2.0. As its title suggest, this book is talking about different best practices that are relevant when it comes to build efficient, scalable and secure RESTful services. So the focus of the book is really on REST best practices. It then shows how you can apply the practices and patterns using the JAX-RS 2.0 APIs.

Some of the covered practices discussed are:

  • How to design and expose your resources
  • Error handling 
  • API versioning
  • Testting
  • Security
  • Caching
  • Asynchronous behaviours, etc.

Another aspect I particularly like about this book is that it also covers features that are not yet part of the standard. It should be mentioned that some of those features (e.g. SSE, JSON-Pointers, ...) will high likely be introduced in Java EE 8. So the book give some useful background material to understand why it would make sense to add those capabilities to the platform.

Finally, the book is really trying to not overload you with too many details, with too much information. For each of the discussed topic, a technical solution is presented and explained. Pointers to additional ressources are then also suggested in case you need to dig into a specific topic in more details.

All in all, this book is a nice reading for anybody designing RESTful based applications... and who isn't?

To celebrate this, Packt Publishing will raffle 10 copies of  “RESTful Java Patterns and Best Practices” (5 eBook copies and 5 paper copies). To participate, just leave a comment about the book on your preferred social media using the 'http://bit.ly/1uUs7QR' URL and the '#JavaBhakti' hashtag. PackT will randomly select 10 lucky persons.

Please do note that Oracle is not involved in this raffle, we are just relaying this information. For any question about this raffle, please contact Packt Publishing directly.

Wednesday Oct 15, 2014

Java SE 8 (and Java EE 7) Comes to WebLogic!

As many of you know one of the key features of GlassFish 4.1 was support for Java SE 8. You may be glad to hear that WebLogic 12.1.3 now is also officially certified against Java SE 8. This makes WebLogic one of the earliest major commercially supported Java EE platforms to certify for Java SE 8. Keep in mind, WebLogic 12.1.3 also supports some key Java EE 7 APIs such as WebSocket, JSON-P, JAX-RS 2 and JPA 2.1 (read this excellent Aquarium entry by my colleague Bruno Borges for details).

This means that you can start using some of the very well received Java SE 8 features such as lambdas, streams and the new Date-Time API in Java EE 6 and Java EE 7 applications even in the most demanding 24 x 7 enterprise environments. WebLogic 12.1.3 has also taken advantage of new JDK 8 features such as improved garbage collection, security enhancements and JDBC 4.2.

You can read more details in a well written blog entry by Steve Felts of the WebLogic team.

Tuesday Oct 14, 2014

JSR 339 Maintenance Release: JAX-RS 2.0 rev A

JAX-RS 2.0 (JSR 339) has been slightly revised through the JCP Maintenance Release process and has recently passed the JCP MR ballot

This update (JAX-RS 2.0 rev A) is mostly about clarifications (including JavaDoc clarifications) and some fixes in Jersey, the JAX-RS Reference Implementation. The updated documents will be published soon on the JSR 339 page but in the meantime, you can check this page for details about the changes of JAX-RS 2.0 rev A.

It should be noted that GlassFish 4.1, the Java EE 7 Reference Implementation, already supports this version of the JAX-RS specification (i.e. JAX-RS 2.0 rev A).