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 10, 2014

JavaOne Replay: eBay and JavaServer Faces

During JavaOne, Sushma Sharma and Ken Paulsen of eBay did a session on Gandalf: 'eBay, Connecting Buyers and Sellers Globally via JavaServer Faces'.

Gandalf is a 'Quick Listing tool'. Gandalf is JSF based tool that let non professional eBay users list their items in order to sell them. Since Gandalf targets non professional users, the tool and the its user interface has to be intuitive and simple. And as mentioned in during the session, that type of users represent the largest population of amongst the eBay sellers. Gandalf an application that is very demanding in terms or features and requirements. Security is obviously a top requirement but accessibility, responsiveness, ... are also very important.

And last but not least, Gandalf is widely used. On a typical day, Gandalf is used by around 200,000 sellers who are adding around 800,000 new listings (again, this is per day!). And that number can grow up to 2.5 millions listings on a peak day! So Gandalf is not really a typical enterprise application, it is more a large scale end-user facing web application.

During their session, Sushma and Ken have discussed JSF, how JSF can scale, ... they have also shared a few JSF tips. Despite the small technical issues (e.g. a few audio hiccups), this J1 session replay is particularly interesting as it clearly kills the 'JSF doesn't scale' myth as this session clearly demonstrate that well designed JSF applications can cope with very demanding requirements.

Thursday Nov 06, 2014

JavaOne Replay: JAX-RS.next

JAX-RS is a key technology of the Java EE platform as REST endpoints are more and more used. Marek Potočiar (JAX-RS Co-Specification Lead) did a session during JavaOne to detail some of the proposed JAX-RS enhancements and extensions that should be part of Java EE 8. These proposals include better support for JSON (JSON-B), improved alignment between JAX-RS and CDI, enhanced support for hypermedia as well as declarative security, server-sent events, and MVC integration. 

Jersey is the open source JAX-RS Reference Implementation but Jersey doesn't limit itself to the specification, i.e. Jersey has also has additional specific features. In some cases, some of the Jersey proprietary features have been standardised and added to the specification (eg. the Client API have been added to JAX-RS 2.0). So it is always interesting to check the Jersey specific extensions as some of those might be potential candidates for inclusion into a future revision of the JAX-RS specification. For example, SSE is currently supported in a Jersey specific manner but the plan is to standardised SSE support in JAX-RS 2.1. So make sure to also watch this 'What's New and Noteworthy in Jersey 2' replay that was presented by Jakub Podlešák and Miroslav Fuksa during JavaOne 2014.

You can get the 'Let’s Talk JAX-RS.next!' slides here.

Wednesday Nov 05, 2014

OTN Virtual Technology Summit

The OTN Virtual Technology Summit is a set of free online events covering various technical topics such as Java SE, Java EE but also Middleware, Database, etc.  Each topic will be presented by a subject matter expert coming either from Oracle or from the community (Java Champions, Oracle ACEs, ...). And during each session, a live chat will let participants ask questions and clarifications on the presented subject. You can check the agenda of the different tracks here.

OTN Virtual Technology Summit is a free event so make sure to register for this month OTN VTS!

  • VTS America : November 18th, 2014 – 9am to 12:30pm PST, register here.
  • VTA Asia : November 19th, 2014 – 10:00am to 1:30pm IST, register here.
  • VTS Europe : November 26th, 2014 – 9am to 12:30pm GMT, register here.

Tuesday Nov 04, 2014

Java EE 8 at Devoxx

Next week (Nov. 10-14), 3.500 Devoxxians from 40 different countries will come to sunny Antwerp to attend the 13th edition of Devoxx (Belgium). Devoxx covers a broad range of topics ranging from Java SE, Mobile and Web Development, Embedded... to Java on the Server. This year Server-side Java track has very good contents including a good Java EE 8 coverage. Also, this year, you have the possibility to ask, in advance, questions to any of the speaker. For that, just check a session page and click on 'Send a question to the speaker'.

You can check the full Devoxx agenda here but here are the sessions that will discuss Java EE 8.

And this is just for Java EE 8! Here are some other Java EE related sessions that are worth to mentions too.

Again, this is just an overview, make sure to check full agenda here.

Also, we are still working on the details but do expect some Java EE 8 coverage during the Devoxx Hackergarten.

Will I see you next week at Devoxx?

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.

Thursday Oct 30, 2014

JavaOne Replay: 'HTTP/2 and Servlet 4' by Ed Burns and Shing Wai Chan

The main focus of Servlet 4 (JSR 369) is to introduce HTTP/2 support into the Java EE Platform. During their JavaOne session, Ed Burns and Shing Wai Chan, the 2 Servlet 4 Specification Leads, gave a good introduction to HTTP/2 and its main features.

Ed and Shing Wai started by explaining some of the HTTP 1.1 limitations we are facing such as Head-of-Line Blocking and how we have all been trying to work-around some of those issues.

They then explained HTTP/2 main features (Binary Framing, Stream Multiplexing and Prioritisation, Server Push, etc.) and how those will solve the HTTP 1.1 limitations.

Some of those new HTTP/2 enhancements are optimisations that are fully transparent to the upper layers (e.g. Stream Multiplexing, Header Compression) but some of those new capabilities might improve applications that are able to exploit them (e.g. Server Push). Ed and Shing Wai showed how the Servlet 4 API might expose some of those capabilities to the developer.

The session was finally concluded with an overview of the HTTP/2 plans for Java SE 9.

Even if you are not really focused on the Web tier, this session is a good HTTP/2 introduction and given the importance of HTTP (and soon HTTP/2), this information should be valuable to your general (IT) knowledge!

You can get the slides here.

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.

Tuesday Oct 28, 2014

JavaOne Replay: 'Java EE 8 Overview' by Linda DeMichiel

In this JavaOne session, Linda DeMichiel (Java EE 8 Specification Lead) gives an overview of what is currently planned for Java EE 8.

Linda starts by explaining the results of Oracle’s Java EE community surveys and the general thought process behind requirements gathering for Java EE 8.  She then gives technical details around some of the planned enhancements :

  • Enhanced support for HTML5 applications and other web tier features such as server-sent events, the new JSON-B JSR for binding JSON payload to Java objects, support for HTTP 2.0, the new MVC framework, etc. 
  • Ease of development including CDI alignment and ease of use with security interceptors, extended use of CDI scopes, the introduction of CDI based model to simplify Message Driven Beans, etc. 
  • Continued support for portable cloud applications. The sessions goes over the planned Java EE Management API but also touches on the new upcoming Security JSR.
Finally, Linda concludes her session by explaining how you can contribute and help to shape the next version of Java EE, i.e. JSR 366.

Watching Linda's session replay will give you a good idea on where the EG wants to go with Java EE 8.

The sesison slides are also available here.

Hint: double click on the video or the slides to adjust their respective size.

Monday Oct 27, 2014

MyBatis-CDI: Persistence Alternative for Java EE

ORM is a by and large proven technique that has been around for a long time now (believe it or not TopLink was created in the early nineties for Smalltalk and then ported to Java). It maximizes code flexibility and database independence while minimizing boilerplate code and allowing the construction of rich domain models. Even for relatively complex domain models and queries, ORM engines tend to generate better quality SQL optimized to the underlying database than the average Java developer would with considerable time and effort. This is precisely why JPA is the persistence standard for Java EE and why a majority of modern server-side applications use ORM (indeed almost every other major development platform including .NET and Ruby on Rails positions ORM as it's default persistence solution).

That being said, there can certainly be cases where using hand-written native SQL is necessary or desirable. Most people don't seem to realize it, but JPA has always included very good support for native queries to meet these use cases (JPA 2.1 now even includes formal support for stored procedures - the ultimate form of database bound query execution). If you weren't aware of this, you should definitely read Taudo Wenzel's excellent write-up on using JPA native queries to generate reports (a common use case for native queries).

In fact you have other options for native SQL centric persistence in Java EE applications. One of the nicest ones is MyBatis-CDI. It provides a very nice CDI based abstraction for MyBatis, making it extremely easy to use in Java EE applications (in case you are wondering MyBatis is the successor to the old iBatis project). Here is how simple MyBatis CDI code can look like:

In addition to JTA transactions, MyBatis-CDI also supports local transactions. I've personally also successfully used Apache Commons DbUtils with CDI to quickly port over a legacy application with tons of hand-written SQL to Java EE/GlassFish.

Thursday Oct 23, 2014

Events in CDI 2.0

CDI 2.0 (JSR 365) was the first Java EE 8 approved JSR. The CDI Experts Group has already been formed several weeks ago and the first CDI 2.0 EG face to face meeting took place last week in Brno (see feedback here). The EG has ambitious plans for CDI 2.0 (see here) and is working hard to fulfils them, you can track the evolution of their work here.

CDI Events is one of the focus area of CDI 2.0. CDI Events is a simple mechanism that provides an implantation of the Observer pattern where the Event Producer is cleanly decoupled from the Event Consumer(s). This mechanism is available in CDI since the beginning, i.e. CDI 1.0. But for CDI 2.0, the EG plans to improve the overall CDI Event mechanism by adding:

  • Asynchronous events
  • Conversation begins/end events
  • Priorities (ordering of events)
  • Observer Deactivation
  • The ability to observe a group of qualified events ("Qualifier Inheritance")
  • ...

Obviously at this stage, those are just plans, just ideas and clearly introducing some of those features leads to quite a few questions and in some case might also induces potential issues if this is not well thought. Another constraint faced by CDI is that it is a transversal technology that is used across the platform so extra care should be taken. All those new features needs to be discussed in details and challenged, and sometime prototyped, before they are standardised into the CDI specification. The CDI 2.0 EG has recently put together an (evolving) document that describes the thoughts but also the challenges behind some of the CDI Events potential enhancements. This is definitely something to read.

CDI Event is today a useful mechanism. If you have ideas on how events can be improved in CDI 2.0, you should really '@Observe' what is being discussed in the EG and 'fire' comments (I know, in code, it's the opposite, i.e. 'fire' triggers the @Observe ;-) ).

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.

Monday Oct 20, 2014

Why Another MVC Framework in Java EE 8?

Some of you may be aware that MVC 1.0 was launched as JSR 371. Targeted for Java EE 8 the goal of the JSR is to provide a standards based action-oriented web framework for Java EE. 'Why' and 'why now' are two perfectly reasonable questions to explore carefully with regards to this JSR. After all JSF has long been included in Java EE as a standards based MVC web framework. In addition although JSF is a component-oriented web framework there are myriad Java web frameworks that are action-oriented including ones that are very Java EE/CDI friendly such as VRaptor (indeed we had a session on VRaptor at JavaOne 2014).

There's little doubt the web framework space in Java has long been hyper-competitive. There are myriad camps each of which insist their way is the "right" way. Nonetheless in most reliable analysis two schools of thought have consistently come out on top for a number of years - component-oriented frameworks (led largely by JSF) and action-oriented frameworks (lately led by Spring MVC but long dominated by Struts). As a result it has been an open question whether Java EE should support both models much in the same way that .NET has done with ASP.NET and ASP.NET MVC. To put this question to rest we included it in the Java EE 8 survey. Despite all the factors above it turned out that the core Java EE community does in fact see the need to include a standard action-oriented web framework in Java EE, which brings us where we are with MVC 1.0. To answer some of the questions that should naturally arise none other than JSF specification lead Ed Burns put together a very nice analysis piece on OTN that's well worth a read. Red Hat's MVC 1.0 expert group representative Joshua Wilson has done the same as well.

It's obviously not  possible to construct an entirely unbiased pro/con analysis matrix for choosing between these two perhaps equally valid major approaches to Java server-side web frameworks. That being said I've tried to encapsulate some of the salient concerns in the graphic below.

I have years of real world development experience with both approaches in case you are wondering; I also favor JSF personally in case you were wondering but see both perspectives. In my view, component frameworks like JSF do extremely well in offering the closest approximation to Smalltalk's original MVC concept, reduce boilerplate to the bare minimum by almost entirely automating controllers/navigation/state handling/event dispatch and truly enable writing re-usable web components. These characteristics shine particularly bright with purpose-built component libraries like PrimeFaces that do a lot of the HTML, JavaScript, CSS heavy lifting for you. However because JSF is a higher level framework that cleverly abstracts away a lot of the underlying HTTP life-cycle there is an initial learning curve. In my view this leaning curve is fairly minimal with JSF 2+ and is only a serious problem with relatively inexperienced developers from a web-development heavy background and no desktop UI development experience.

Action-oriented frameworks try to accomplish far less in comparison. They provide a thinner MVC-like facade that leaves a lot of the work of writing controllers, HTTP handling, navigation, state maintenance, HTML/JavaScript/CSS authoring to the developer. There is really no concept of components beyond relatively elementary templating. As a result these frameworks do not generally have component or plug-in ecosystems. These characteristics make learning the framework easier for beginners that perhaps have a background in vanilla web development, PHP, JSP, ASP classic and the like. Because the framework does not alter the HTTP life-cycle or HTML rendering much it is easier to integrate arbitrary HTML, JavaScript and CSS tools.

To apply a very broad generalization the way I have seen this play out is that heavily form/workflow driven applications where Java developers do a lot of the UI work tends to be written in JSF. There are exceptions (such as eBay - they presented on their JSF usage at JavaOne 2014) but these applications usually reside behind corporate firewalls. More public facing web applications often dominated by web developers tend to be written using action-oriented frameworks.

I hope this helps answer some of the questions you may have had. JSF is here to stay and continues to have a strong community behind it. JSF 2.3 was launched as JSR 372 and is also targeted for Java EE 8. MVC 1.0 will join JSF as a first class peer in Java EE for folks that prefer an action-oriented web framework.

If either of these technologies strongly interest you and you have the time to spare, now is the time to apply to join the respective expert group. Note that you can always participate in a JSR without officially being part of the expert group by simply subscribing to the JSR user alias. Also remember that you can contribute on an even more lightweight format through Adopt-a-JSR.

Please note that any views expressed here are my own only and certainly does not reflect the position of Oracle as a company.

Friday Oct 17, 2014

Calling All REST/JAX-RS Enthusiasts: Join JAX-RS 2.1!

As you might be aware, the initial wave of Java EE 8 JSRs are now launched, including the platform JSR itself, CDI 2, JSON-B, JMS 2.1, Servlet 4, JAX-RS 2.1, MVC and JSF 2.3. Most of these JSRs are now actively looking to form their initial expert groups, including JAX-RS 2.1 (filed as JSR 370). Indeed, the JAX-RS specification leads are looking to evaluate the initial set of expert group members fairly quickly - by Wednesday, October 22nd.

Although it's currently slated to be a point release (this can always change), JAX-RS 2.1 is aiming to accomplish quite a bit. Here is a very high level summary of the items currently under consideration:

  • Adding support for SSE.
  • Improved integration with CDI.
  • Exploring support for non-blocking I/O in providers (filters, interceptors, etc.).
  • Evaluating ways in which declarative security can be supported either directly in JAX-RS or by leveraging the Java EE Security JSR (still to be filed).
  • Providing integration with newly filed JSON-B JSR.
  • Building upon the Hypermedia support added in JAX-RS 2.
  • Investigating the reactive programming paradigm as a way to improve the JAX-RS asynchronous client API.
  • Any possible work necessary to support the newly filed MVC 1.0 JSR.

Specification lead Marek Potociar did an excellent job overviewing the possibilities in his JavaOne 2014 talk Let’s Talk JAX-RS.next!. His slides are available here.

Note that you can always participate in a JSR without officially being part of the expert group by simply subscribing to the JSR user alias. In case of JAX-RS, that alias is users at jax-rs-spec dot java dot net. Also remember that you can contribute on an even more lightweight format through Adopt-a-JSR.