Thursday Feb 26, 2015

Jersey, from Android to Mainframe

As usual, the Jersey Team is busy cranking out new releases. In February, the team has released Jersey 2.16 (release notes, change log) and Jersey 1.19 (blogchange log).

Jersey has a large, active and involved community. For example, there was a bug in Jersey when used on z/OS (who doesn't use Jersey on z/OS?). A community member raised this particular issue along with a suggested fix, fix which has been integrated in 2.16.

Jersey 2.16 is also solving some of the issues related to running the Jersey client stack on Android. Supporting Android is more a side project and Jersey 2.16 clearly shows some initial success. But more work needs to be done. The Jersey Team is looking for concrete feedback on real uses-cases and why not, community contributions too.

So with 2.16, you can finally run a Jersey client on an Android phone connecting to a Jersey server running on Z/OS! Yeah!

And it's not because the Jersey community is already large and active that you cannot participate, contributions are always welcome! See here on the different ways to contribute to Jersey.

Wednesday Feb 25, 2015

Unsynchronized Persistence Contexts in JPA 2.1/Java EE 7

One of the more obscure features introduced in JPA 2.1 and Java EE 7 is the unsynchronized persistence context. It's not too surprising that the community does not seem to discuss it much - it's really geared towards somewhat an edge case.

Prior to JPA 2.1, the entity manager is always synchronized with the database when a JTA transaction commits. This poses a challenge if you have a multi-step workflow (let's say in a stateful session bean/CDI conversation/JSF flow) where you want some data to be flushed to the database on transaction commit at a given stage of the workflow but not all - but you do eventually want to synchronize all changes at some other point in the workflow. Non-standard solutions like Seam and the Hibernate flush mode have been the answer in the past to get around this problem. This is now solved in JPA 2.1 via the unsynchronized persistence context. In an unsynchronized persistence context changes are not automatically flushed to the database on transaction commit. Rather, you explicitly join the transaction when you want changes synchronized.

Hantsy Bai does a decent job explaining this through code examples. By far the best explanation of the feature comes from specification lead Linda DeMichiel. Check out minute 11-14 in the short video below (if you are having trouble accessing the embedded video it is available here).

What do you think of the feature? Do you think it is useful or obscure? The JPA spec is the best place to get further details if this intrigues you.

Tuesday Feb 24, 2015

JavaOne Replay: Java EE Game Changers

David Blevins is a frenetic actor in the overall Java EE Ecosystem. Over the years, he has been involved in various open source Java EE related projects (e.g. OpenEJB). David is now actively working on TomEE which he launched in 2011. So it is fair to say that David knows what implementing Java EE means.

In addition, David is involved in different JCP Expert Groups where he is helping to shape the future versions of Java EE. So David has multiple hats: implementor, contributor and active participant in different EGs.

In this JavaOne session, David is sharing, in a technical (and non traditional) way, his enthusiasm about Java EE and the JCP. In his 'Java EE Game Changers' talk, David looks back at Java EE, he discusses some aspects that have changed the way we program Java EE applications. David also talks about points such as testability in Java EE. Finally, David is also sharing some of the ideas he is pushing forward, through his involvement in the JCP, to improve Java EE (e.g. MDB replacement in JMS 2.1).

This is great session to watch! This talk is also highly recommended to anyone who still has doubts about the Java EE Platform! The only grief one could do about this session is that one hour is too short for such an enthusiast and knowledgable speaker!

Monday Feb 23, 2015

Rakuten: Java EE Adoption in One of the World’s Largest Online Financial Systems

One of the most important things to do at this stage of the life-cycle of Java EE is highlight successful adoption stories. We have been doing just that for a long time through our adoption stories blog as well as JavaOne. JavaOne 2014 was particularly good in this regard and JavaOne 2015 looks to be even better. Indeed we hope the folks with great adoption stories that submitted last year but did not get accepted will resubmit next year. We will highlight some of those sessions from JavaOne 2014 in the next few months and the best place to start is the Java EE adoption story from Rakuten.

Rakuten is one of the largest online financial systems in the world. It is the number one e-commerce platform in Japan generating over 51 billion dollars of yearly revenue and growing on a global scale. It is easily one of the most technically adept companies in Japan and perhaps the world. They had a legacy system build around J2EE and a hodgepodge of various non-standard frameworks such as Spring, Apache Axis and iBatis. They chose to adopt Java EE over these technologies including alternatives such as .NET. They cited vendor neutrality, choice, simplicity, community, ease-of-learning, ease-of-use and productivity as great reasons for selecting Java EE for their next generation platform. They fully leverage Java EE including key APIs such as JSF, CDI, EJB, JPA, JTA and JMS. Along with Java EE they also chose WebLogic as well as Oracle DB/Exadata. They cited performance, scalability, reliability, productivity and support for choosing WebLogic, Oracle DB and Exadata. They also use best-of-breed tools such as NetBeans, Maven, Jenkins and the Atlassian suite of solutions. They achieved the astounding technical feat of completely overhauling their 24/7, extremely high volume online transactional system in just six months including training!

You can see Hirofumi Iwasaki and Arshal Ameen's awesome JavaOne 2014 presentation below (if you are having trouble seeing the embedded video it is available here).

The slide deck from the talk is posted below (if you are having trouble seeing the embedded slideshow it is available here).

Hirofumi Iwasaki and Arshal Ameen have been great advocates of Java EE, especially in Japan. We hope to continue to see great things from them and Rakuten. Rakuten is looking forward to learning and applying Java EE 7 in the real world as soon as possible.

If you have a great Java EE adoption story to share, please do drop us a note (particularly migration stories from other technologies). In the spirit of Java EE centric vendor neutrality, what Java EE implementation or tool set you choose does not matter at all and neither does which part of the globe you are in.

Friday Feb 20, 2015

Java EE @ CodeMash 2015

CodeMash 2015 took place 6-9 January in Sandusky, Ohio at the exotic Kalahari Waterpark Resort. With another sold-out year, CodeMash is quickly becoming one of the larger developer conferences state-side. It has it's roots in .NET, but is making a concerted effort to better attract a Java audience. Topics covered included .NET, methodology, JavaScript/HTML, mobile, cloud, DevOps, Hadoop, NoSQL, Docker, Java SE and Java EE.

I delived sessions on aligning Java EE 7 with the JavaScript/HTML5 rich client landscape, reactive programming support in Java EE and what's coming in Java EE 8. More details on the sessions and CodeMash, including the slide decks and code, posted on my personal blog.

Thursday Feb 19, 2015

HTTP/2 is done

...well almost! There are still some minor processes to go through before they are published as official RFCs but the IESG has formally approved the HTTP/2 and HPACK specifications! So clearly, it’s safe to say that HTTP/2 is done! And given how vital the HTTP protocol is in today’s world, this is really important news.

The fact that HTTP/2 is binary based (Vs. HTTP 1.x being text based) removes lot of technical barriers that (text-based) HTTP 1.x had and allows the introduction of new capabilities. Those new capabilities (e.g. stream multiplexing over a single TCP connection, stream prioritization, server-push, etc.) are more than welcome as they will reduce the overall Web latency. HTTP/2 will also help to get rid of the various “hacks” (e.g. file concatenation, domain sharding) that were put in place to work-around the HTTP 1.x limitations (e.g. Head-of-Line blocking).

HTTP/2 maintains a high-level compatibility with HTTP 1.x and preserve a lot of its predecessors concepts (e.g. URI, headers, etc.). So from a Java EE developer point of view, the HTTP/2 impact will be relatively minimal and only a few HTTP/2 aspects will be exposed to the developer through the Servlet API (Server-Push & Stream Prioritization). This work is conducted right now in the Servlet 4 (JSR 369) Experts Group (see EG discussions here).

And even if you are not a Web-tier developer, it is important to understand HTTP/2 and what it brings. For that, you are strongly encouraged to watch the session that Ed Burns and Shing wai Chan (Servlet 4 Specification Leads) gave during last JavaOne on HTTP/2 and the Servlet 4 plans (slides here).

Tuesday Feb 17, 2015

Tyrus and Autobahn|Testsuite compliance

The Tyrus Team has just released Tyrus 1.10 (JSR 356 Reference Implementation). With only a few fixes (see Pavel's blog for details), this release could be seen as a minor one. It is however an important milestone as it is the first Tyrus release that passes the Autobahn|Testsuite, a test harness used to verify WebSocket client and server implementations for specification conformance and implementation robustness.

In this release, the Tyrus Team has also introduced 2 new samples that explore ways of sharing data between JavaScript and Java (see Pavel's blog for more details). 

Additional resources: 

Monday Feb 16, 2015

Manfred Riem Discusses JSF and Java EE MVC on JSF Central Podcast

Manfred Riem was a guest on the most recent JSF Central Podcast. For those unaware Manfred is the co-specification lead for both JSF 2.3 and Java EE MVC 1.0. Manfred talked about Mojarra, JSF 2.2, JSF 2.3 as well as MVC 1.0. The podcast is available here and you can read the transcript here.

The podcast is led by Kito Mann - well respected enterprise consultant, author, blogger and JSF community member. Kito has been a long time supporter of JSF with a long track record of contributing as a JCP standards group expert.

The newscast is in fact part of the JSF Central portal and covers topics of interest for the JSF ecosystem. Past contributors to the podcast have included folks like Ed Burns, Cagatay Civici, Neil Griffin, Lincoln Baxter and Shay Shmeltzer. All of the podcasts are archived here.

Besides the podcast, the JSF central portal itself is a very valuable resource for the JSF community you should explore. It does a very nice job listing JSF articles, books, projects, products and other resources.

Friday Feb 13, 2015

The JavaOne 2014 Rock Stars are Here!

The JavaOne team just announced the Rock Star speakers for JavaOne 2014. Not very surprisingly Java EE had a strong showing. That's very significant as the Rock Stars are based on attendee ratings. I am extremely humbled to join the very fortunate ranks this year. Having an insider view of JavaOne, I know exactly how selective JavaOne really is (it is by far the most selective Java conference in the world). For that reason to me every speaker at JavaOne is a star on their own right. The Rock Star awards are just an attempt to recognize the talent and hard work of some of these people using some set of objective criteria.

Here are the Java EE Rock Star speakers and their highly rated talks (linked are the videos):

You can find the full list of Rock Star speakers and their talks here. Who knows, maybe you join these ranks next year?

Thursday Feb 12, 2015

Project Avatar Update

Project Avatar began 3+ years ago as a client side JavaScript project in an effort to participate in and learn from the JavaScript community. With client-side JavaScript frameworks evolving at a rapid pace and leaders starting to separate from the “pack”, we leveraged our Middleware strength and added a server-side component. Project Avatar was released to the community at JavaOne 2013, and delivered an end-to-end JavaScript programming model who’s server-side component was aligned with Java EE compatible containers like GlassFish and WebLogic. Avatar.js, the Node.js compatible runtime, provided the ability to use Node libraries within Java EE compatible containers like GlassFish and WebLogic.

However, we ran into Node.js compatibility issues with this approach, performance issues (tuning for Java EE and Node in same VM), and the programming model we introduced achieved some limited interest in the Java EE community and the Node community. With that in mind we began work on what we call “Avatar 2.0”, which focused on Node compatibility and running in its own JVM, along with continued Java interoperability and Java EE-related interoperability like layering a JavaScript library on top of JPA.

What we began to find is that the services that were of interest have begun exposing functionality via RESTful APIs directly. For example, the Oracle Database Node.js Driver makes direct Java interoperability with Java EE for Node applications less interesting. Rather than trying to reinvent Avatar again, we have decided to put it on hold and let the market evolve a bit. We’ll continue to track the industry and re-evaluate down the road.

With that being said, we have learned a lot about JavaScript and Node.js in the process, and the Avatar work has been leveraged within Oracle more than meets the eye. For example, the early need for WebSockets within Avatar resulted in Tyrus, the WebSocket implementation in GlassFish and WebLogic today. The performance improvements Avatar really needed out of Nashorn have been delivered to Nashorn users within multiple JDK releases, including the forthcoming JDK 8 Update 40. Last, we realized just how important the Node.js community is. While Avatar is being put on hold, we are ramping up our investment in Node.js with the planned delivery of the Oracle Node Cloud Service in 2015, built on native Node.js. In addition, we do see a lot of tactical interest in using Nashorn within Java Applications, as described for example by InfoQ and Adam Bien.


We'd like to thank those who have provided us feedback throughout the life of Project Avatar. It has been very much appreciated and helped us us more than you know.

Avatar and Avatar.js project pages, along with the code and related binaries, will remain available for folks to learn from and leverage.

JavaOne Is Coming to Brazil!

The flagship Java technology conference is returning to Latin America! JavaOne will take place on June 23–25 in São Paulo - Brazil.

We all know Brazilians are vocal Java supporters but clearly, this event open to all! And in order to have a strong Server-Side track, we need your support. So please make sure to submit your Java EE related proposals as soon as possible as there are only 2 weeks left to do so (the CFP is closing end of February).

Registration will open soon. For more information about JavaOne Latin America, you can check this site. Site which will be updated with more details as we get closer to the event.

Wednesday Feb 11, 2015

Java EE @ Java2Days 2014

Java2Days 2014 was held on November 17-19 in Sofia, Bulgaria. It is far and away the largest Java conference in the Balkans region and now perhaps one of the most important conferences in Europe as a whole. This was another great year for this rapidly growing, vibrant event. It attracted a host of international and local speakers including Arun Gupta, Geertjan Wielenga, Roberto Cortez, Ivan St. Ivanov, Andy Gumbrecht and Andrew Lombardi. Topics included Java SE, Java EE, HTML5/JavaScript, mobile, OSGi, IoT and the cloud. I am extremely grateful that the organizers invited me again this year and very glad that I was able to accept.

Java EE had a strong showing this year:

  • What's Coming in Java EE 8 - me
  • Nuts and Bolts of WebSocket - Arun
  • Java EE 7 Hands-on Lab - Arun, Ivan and me
  • Apache Tomcat to Apache TomEE in 1-n Steps - Andy Gumbrecht
  • Java EE 7 Batch Processing in the Real World - Roberto and Ivan
  • Coding for Desktop and Mobile with HTML5 and Java EE 7 - Geertjan
  • JavaScript/HTML5 Rich Clients Using Java EE 7 - me, Ivan
  • Forge and Arquillian Hands-on Lab - Ivan, me
  • Why Open Standards and Java/EE Matter (to You) - me

More details on the sessions and Java2Days, including the slide decks, video and code, posted on my personal blog.

Tuesday Feb 10, 2015

Java EE 7 Maintenance Release

The Java EE 7 specification (JSR 342) was finalised end of May 2013 and since then, various minors errors have been reported. Those will soon be addressed as the Java EE 7 specification will go through a maintenance release (see Linda's announcement here).

You can check the proposed changes here and a draft of the specification with the proposed changes incorporated here.

Those proposed corrections should only impact the specification document itself and not the Reference Implementation nor the TCK. So once this MR will be done and voted, the version of the specification should be Java EE 7 Rev A.

Friday Feb 06, 2015

Java EE @ JDK.IO 2014

JDK.IO 2014 was held in Denmark on January 19-20 at the IT University of Copenhagen. It is the yearly conference of 'JavaGruppen', the Danish JUG. The conference sessions covered a variety of Java topics ranging from core Java, Java EE, and JavaFX. Speakers included my colleague David Delabassee, Simon Ritter, Adam Bien, Heinz M. Kabutz, Bert Ertman, Ryan Cuprak, Simon Maple and Markus Eisele.

David covered the Java EE portion of the keynote. He also presented a talk on Java EE 8. His slides from SlideShare are embedded below:

My friend, fellow co-author of EJB 3 in Action, Connecticut JUG leader and JavaOne Rock Star Ryan Cuprak presented a couple of very cool sessions. The first one, titled Hybrid Mobile Development with Apache Cordova and Java EE 7 demonstrates how Java EE can be used as a very effective mobile development back-end using APIs like JAX-RS, WebSocket and JSON-P. The talk was delivered at JavaOne 2014 as a tutorial and includes an excellent end-to-end demo. Video from the JavaOne talk is embedded below:

Ryan also presented another popular talk from JavaOne 2014 - 50 EJB 3 Best Practices in 50 Minutes. At JavaOne he had co-presented the talk with my other co-author Michael Remijan. The video from that talk is embedded below:

Ryan wrote up a very nice trip report of JDK.IO on his personal blog that you should check out. Other Java EE related talks included one by Markus Eisele on Java EE 7 and Apache Camel.

Thursday Feb 05, 2015

MongoDB as a Glassfish Security Realm

As many of you know application servers like GlassFish have excellent built-in support for common authentication providers like a database or LDAP. Using these as security realms is typically just as simple as a few clicks on an admin console UI or a command (or two) using the admin CLI. But what if your authentication storage mechanism is a little more exotic? How about something really exotic like the popular MongoDB NoSQL database? Is there a way to make it work with GlassFish/Java EE security?

Not to worry - in that case you are looking at creating a custom JAAS based authentication module, configuring it with GlassFish and using it as a Java EE security realm instead of using one of the built-in choices. It's really not as scary as it sounds - Lee Chuk Munn from the Advanced Technology Applications Practice for the National University of Singapore, Institute of Systems Science shows us exactly how to do it, step-by-step. In a characteristically awesome blog post, he explains the basics of GlassFish security realms, creating a JAAS based custom authentication module for MongoDB, registering the module as a security realm and using it. Enjoy!