Monday Sep 29, 2014

jBatch Suite: Visual Development for the Java API for Batch Processing/Java EE 7

As many of you know, the Java API for Batch Processing (JSR 352) is one of the key APIs added in Java EE 7. The API is largely based on POJOs, annotations and some XML. As a result you can be pretty productive even without an IDE. As a Java developer, however, like me you probably enjoy the usability of modern IDEs like NetBeans and may be wondering what IDE support there is for the Java API for Batch Processing. Although Java IDEs have been very good about supporting Java EE 7 generally, none of them have had much specific support for JBatch - until now that is. Sensing a gap Gaurav Gupta has stepped up with jBatch Suite. jBatch Suite is a NetBeans plugin that allows for both UML style modelling and code generation for Java Batch. Conveniently, it is available through the NetBeans Plugin Portal Update Center (Tools > Plugins). The following video is a great overview of the basic functionality in the plugin:

Gaurav has actually put together a very nice set of video demos covering the majority of functionality in the plugin on YouTube. The NetBeans plugin website offers further details as well as download. Contributions are welcome through the project for the plugin. Enjoy!

Friday Sep 26, 2014

Kito Mann's JSF Sessions at JavaOne 2014

For the Java EE track at JavaOne 2014 we are highlighting some key sessions and speakers to better inform you of what you can expect, right up until the start of the conference.

To this end we recently interviewed Kito Mann. Kito has long been a respected JSF consultant, popular speaker, author and JCP expert. He is the editor-in-chief of, co-host of the Enterprise Java Newscast, host of the JSF Podcast interview series, and the author of JavaServer Faces in Action from Manning publications (I met him a long time ago in the process of writing EJB 3 in Action).

Kito has one the highest number of talks from a single speaker in the Java EE track this year. We wanted to talk to him about his JSF sessions at JavaOne 2014, as well as JSF generally:

The following are the sessions we talked about:

  • JSF 2.2 Deep Dive: This tutorial is a two-hour deep dive into all the new features in JSF 2.2 and is probably one of the best bits of training you can have on the technology.
  • PrimeTime JSF with PrimeFaces 5: This session is a look into what is new in PrimeFaces 5, easily the most popular part of the JSF plugin ecosystem.
  • JavaServer Faces Antipatterns and Best Practices: This is an invaluable session if you are a JSF user. Kito shares his wealth of experience as a JSF consultant and navigates the best practices, patterns and anti-patterns for the technology.
  • Mobile JavaServer Faces: This is a deeply well researched session on the available resources for developing mobile applications using JSF. If you are a JSF user being asked to develop mobile functionality, this session is definitely for you.
  • JSF 2.2 in Action: In this one hour session, Kito will overview the features introduced in JSF 2.2 using demos and real life context.

Besides Kito's sessions, we have a very strong program for the Java EE track and JavaOne overall - just explore the content catalog. If you can't make it, you can be assured that we will make key content available after the conference just as we have always done.

Thursday Sep 25, 2014

Spotlight on GlassFish 4.1: #11 Enable Remote Admin

Spotlight on GlassFish 4.1' is a series of posts that highlights specific enhancements of the latest GF release, GlassFish 4.1. It could be a new feature, a fix, a behavior change, a tip, etc.

#11 Enable Remote Admin

When you unzip GlassFish 4.1, the Administration user has no password set. This was introduced quite some time ago to simplify the developer experience. For obvious security reasons, the remote admin capabilities are also disabled. So the default Admin user is 'admin' and its password is empty.

To enable remote Admin, you should first define a password for the admin user and then enable remote admin. The trick is that the change-admin-password command is asking the admin password, in that case you should leave it empty.

./asadmin change-admin-password 
Enter admin user name [default: admin]> [leave it empty to use the default value]
Enter the admin password> [make sure to leave this field empty]
Enter the new admin password> myNewPassword
Enter the new admin password again> myNewPassword
Command change-admin-password execute

You can enable the securre-admin.

./asadmin enable-secure-admin
Enter admin password for user "admin"> [fill in the new password you have defined]
You must restart all running servers for the change in secure admin to take effect. Command enable-secure-admin executed successfully.

And just restart the domain and you are all set!

./asadmin restart-domain domain1

The 'empty admin password' is mentionned in the initial page of the first chapter of the Administration Guide.

Wednesday Sep 24, 2014

Java EE 8 JSRs Unanimously Approved!

The 7 JSRs submitted in August for Java EE 8 have been unanimously approved, with 24 'Yes' votes, by the JCP Executive Committee!
The different Specification Leads are now starting to formally assemble their Expert Group (see instructions for joining the JCP). JUG members can also help with any of these JSRs through the Adopt-a-JSR Program. And in case of doubt, just reach out to the Specification Lead you wan to work with, he/she will be able to guide you (e.g. JMS).

Those recently approved JSRs added to CDI 2.0, which was approved a few weeks ago, give us an impressive initial set of 8 JSRs for Java EE 8!

Tuesday Sep 23, 2014

MVC 1.0 (JSR 371) at JavaOne

In the early days... well... just a few weeks ago, the idea was to standardise MVC under the JAX-RS umbrella.  At that time, we didn't think to submit a JavaOne proposal for a dedicated MVC session. But since then, a lot of things has happened and MVC has now its own JSR (see here for some background).  

Fortunately, we were able to squeeze, the the JavaOne schedule, a dedicated MVC 1.0 BoF. This BoF will be hosted by Manfred Riem who is leading this new specification with Santiago Pericas Geertsen. It will take place on Tuesday Sep. 30 (7:00-7:45 PM) at the Hilton (Continental Ballroom 4), make sure to add it to your schedule!

Manfred is also co-leading JSF 2.3, you can see Manfred's JavaOne duties here.

Monday Sep 22, 2014

Meet the Java EE 8 Experts at JavaOne

During JavaOne, you will have many occasions to discuss with different Java EE Specification Leads or other key Java EE staff:

This year, we have also arranged a Meet the Experts area. It is a designated space in the JavaHub where most of the Specification Leads will be present at a dedicated time (see schedule below). Oracle's Java EE Evangelists and Heather VanCura from the JCP will also be present. It will be the ideal place to carry on informal conversations about Java EE8. Also, keep in mind that the various Expert Groups are being formed so it is also the perfect time to ask what it takes to join an EG!

Monday, September 29 (Dedicated pavilion hours: 1:30-2:30 PM)

10-11 AM  Bruno Borges  Adopt-a-JSR for Java EE 8, any Java EE 8 technologies
11-12 PM  Martin Grebac  JSON-B
12-1 PM  Kin-man Chung  JSON-P and EL
1-2 PM

 Marek Potociar

 Pavel Bucek 

 JAX-RS 2.1

 WebSocket 1.1

2-3 PM  Linda DeMichiel  Java EE 8
4-5 PM  Reza Rahman  Adopt-a-JSR for Java EE 8, any Java EE 8 technologies

Tuesday, September 30 (Dedicated pavilion hours: 1:30-2:30 PM)

10-11 AM  Heather VanCura  JCP/JCP.Next (JSR 364), Adopt-a-JSR
11-12 PM  Martin Mares  Java EE Management
12-1 PM  Nigel Deakin  JMS 2.1
1-2 PM  Reza Rahman  Adopt-a-JSR for Java EE 8, any Java EE 8 technologies
2-3 PM  Ed Burns, Shing Wai Chan  JSF 2.3 and Servlets 4.0
4-5 PM  Marek Potociar  JAX-RS 2.1

Wednesday, October 1 (Dedicated pavilion hours: 2:00-3:00 PM)

12-1 PM  Brian Oliver  JCache
1-2 PM  David Delabassée  Adopt-a-JSR for Java EE 8, any Java EE 8 technologies
2-3 PM  Manfred Riem  MVC 1.0 and JSF 2.3

Wednesday Sep 17, 2014

JMS 2 Hands-on-Lab Video and Materials

I ran a virtual JMS 2 hands-on-lab on August 14th. Stephen Chin graciously hosted the lab through his excellent NightHacking virtual worldwide meetups. The goal of the lab was to give attendees some first-hand experience with the primary changes in JMS 2. In the first hour or so I did a brief presentation overviewing JMS 2 and went over the JMS 2 Javadocs. The rest of the time attendees actually wrote JMS 2 code mostly by themselves. There was also some pretty good interaction and Q&A throughout the lab. The entire lab was video recorded and is available below. The slides I used are available on SlideShare.

The lab materials are hosted on GitHub for anyone to use. The lab uses NetBeans 8, GlassFish 4 and Arquillian. I've deliberately designed the lab materials to be fairly self-guided so you can definitely use the lab materials on your own (or perhaps even run the lab in your own company/JUG?) . You are always welcome to reach out to me when needed.

Whether it can be called TDD (Test-Driven Development) is debatable but in the lab you'll basically be putting in code to finish a set of JUnit tests using JMS 2, starting from incomplete code with comments on what to do (don't worry, a completed solution is also posted :-)).

Tuesday Sep 16, 2014

Java EE Configuration JSR Deferred

Configuration was one of the more popular items on the Java EE 8 survey. While the exact features that would be included in a configuration JSR for Java EE remains relatively vague, I think we were all looking forward to a possible JSR largely spearheaded by Anatole Tresch of Credit Suisse. The idea was that such a JSR would provide a cohesive solution for configuring Java EE applications and would receive a level of support from Oracle, including possibly sharing responsibility for leading the specification. Unfortunately the configuration JSR effort has currently been deferred for unforeseen but unavoidable circumstances principally related to long-term resourcing commitments especially for developing and maintaining the associated reference implementation (RI) as well as the compatibility test kit (TCK).

This is truly unfortunate as this would have been a shining example of a non-Java EE vendor (in this case Credit Suisse) contributing a significant part of the Java EE platform. It is still important to applaud Anatole Tresch for his initiative, passion, dedication and courage. Similarly the community should be grateful to Credit Suisse for seriously considering such a significant investment to help move the Java EE platform and community forward. As all of us in IT know, making tough calls on resourcing is never easy and it is far better to make difficult decisions early rather than at later stages of an effort. Anatole is still moving forward with his JavaOne 2014 talk on the configuration JSR effort. The talk is a great opportunity to share ideas and solidify underlying use cases through community feedback. This thought provoking post alludes to some of the complex uncertainties that this JSR would need to carefully explore.

While a cohesive configuration JSR effort must be deferred at least for now, there is no reason to dismay too much. Some of the more well-understood problems that such as JSR would have solved could still be considered as part of the Java EE 8 platform JSR. A separate JSR would have likely required a high degree of collaboration at the platform level anyway. Another possibility is to have core APIs like CDI consider what needs to be done to make configuration easier in Java EE. Lastly, it's worth keeping in mind that some of the problems that such as JSR would have addressed may already be solvable using mechanisms included in Java EE or with tools that are commonly used in Java EE development such as:

  • Using the <alt-dd> tag that has been included in Java EE for a while.
  • CDI @Alternative.
  • JSF project stages.
  • The configuration centric features included in DeltaSpike Core. The mature Apache Commons Configuration project has had similar capabilities for a while, albeit more focused on look-up (rather than injection) and Java SE (rather than Java EE).
  • The rich set of configuration and conditional build focused Maven features such as profiles and replacers (this really isn't anything specific to Maven, most emerging or mainstream build systems have such capabilities for good reasons).

In my own personal experience as a consultant I have found the Maven features in particular a sufficient, easy-to-use and elegant solution for the vast majority of Java EE projects. That being said the distinction for the configuration JSR might have been that while Maven is a build-time solution, there is perhaps a need to solve configuration issues at deployment-time or at run-time. One should note though that while dependent upon non-standard tooling many modern application servers do support changing JNDI bindings at runtime.

What do you think? As always, don't hesitate to sound off here.

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

Monday Sep 15, 2014

Spotlight on GlassFish 4.1: #10 WebSocket Client Redirect

Spotlight on GlassFish 4.1' is a series of posts that highlights specific enhancements of the latest GF release, GlassFish 4.1. It could be a new feature, a fix, a behavior change, a tip, etc.

#10 WebSocket Client Redirect

A WebSocket connection is always initiated using HTTP (or HTTP/S). After a successful handshake, the HTTP connection is upgraded to a WebSocket connection using the HTTP 1.1 upgrade header.

Tyrus and GlassFish 4.1 now support HTTP 3xx Redirect handling during the WebSocket handhake phase. This feature allows a WebSocket server end-point to transparently redirect clients to another server end-point. Tyrus WebSocket client can be configured to accept to be redirected. The number of redirections allowed is also configurable (eg. to avoid infinite redirection loop).

For more details on this feature, please check this section of the Tyrus documentation.

Friday Sep 12, 2014

JSR 370: Java API for RESTful Web Services 2.1

A proposal for JAX-RS 2.1 has been recently submitted to the JCP, this news was a bit overshadowed by the Java EE 8 Platform submission announcement but it is also important. It is important as JAX-RS is a significant technology of the the Java EE Platform but JAX-RS is also very relevant outside of the platform. It is not uncommon to see more specific RESTful based applications built upon a standalone JAX-RS implementation. And with the Client API introduced in JAX-RS 2.0, JAX-RS is also getting more and more relevant in the client space.

JAX-RS 2.1 (JSR 370) has now entered the JSR Review Ballot for a 2 weeks period (ends on September 22). The proposed scope of JAX-RS 2.1 currently includes :

  • Adding support for Server-Sent Events
  • Improving integration with CDI
  • Exploring support for non-blocking I/O in providers (filters, interceptors, etc.)
  • Evaluating ways in which declarative security can be supported
  • Providing integration with JSON-B
  • Making JAXB conditional on runtimes where it is available
  • Building upon the hypermedia API introduced in version 2.0
  • Investigating the reactive programming paradigm as a way to improve the JAX-RS asynchronous client API
  • Evaluating any requirements necessary to support the use of JAX-RS resource classes as controllers in the MVC 1.0 JSR

Even tough JAX-RS 2.1 will be a 'minor' release; its current scope is quite large in terms of added features!

And if you are attending JavaOne, here are a few JAX-RS related sessions that you should consider attending :

Thursday Sep 11, 2014

Antoine Sabot-Durand's CDI Sessions at JavaOne 2014

For the Java EE track at JavaOne 2014 we are highlighting some key sessions and speakers to better inform you of what you can expect, right up until the start of the conference.

To this end we recently interviewed Antoine Sabot-Durand. Antoine is the newly minted CDI specification lead. In the short time that he has been at Red Hat, he has already had the CDI 1.2 specification under his belt and he has already started work for CDI 2 (CDI 2 is a major overhaul of the specification targeted for Java EE 8). I have known about Antoine since he worked on Agorava, a social media module for CDI/Java EE. Besides working on the CDI specification, he is also responsible for the CDI ecosystem at Red Hat - currently focused on DeltaSpike.

We wanted to talk to Antoine about his CDI sessions at JavaOne 2014:

Antoine has several sessions on the track that he talked about:

  • Introducing Contexts and Dependency Injection: This is essentially a CDI primer for folks that are still newcomers or evaluating. It's probably worth attending as a refresher even for more experienced folks.
  • Going Farther with CDI 1.2: This is a slightly more advanced session talking about less commonly used features as well as the changes in CDI 1.1/CDI 1.2. The CDI ecosystem generally is also covered.
  • The Path to CDI 2.0: This is essentially a CDI futures talk. It's probably the best way to find out what is in the works for CDI 2.
  • CDI 2.0 BOF: This informal Birds-of-a-Feather session is a rare chance for you to interact directly with the folks leading the CDI specification and share your ideas, questions and feedback. It's probably the best and easiest way for most folks to contribute directly to the CDI specification.

Besides Antoine's sessions, we have a very strong program for the Java EE track and JavaOne overall - just explore the content catalog. If you can't make it, you can be assured that we will make key content available after the conference just as we have always done.

Wednesday Sep 10, 2014

Supporting CORS in JAX-RS 2/Java EE 7

Many developers, especially more inexperienced ones, don't seem to realize that browsers automatically enforce the well-known same-origin policy. This means that browsers will make sure that any scripts (likely JavaScript :-)) can only access URLs on the same server that the script came from. For most applications this is not an issue. However, in some deployment scenarios (e.g. JavaScript clients on a plain web server trying to access REST resources on a separate back-end application server) this can be a real and unexpected problem. The solution to this problem is CORS or Cross-Origin Resource Sharing. If you are not familiar with CORS, you should read the detailed write-up here. Essentially using CORS a server side resource indicates that it is explicitly allowing an exception to the same-origin policy.

JAX-RS users should ask how they can handle CORS if the need arises. The answer to this question is that while most JAX-RS providers may not yet support CORS out of the box, it is pretty easy to handle this yourself using JAX-RS 2 server-side filters. Max Lam does a very nice job showing you how in a code-intensive blog entry. The entry is actually a nice demonstration of JAX-RS 2 filters in action in the real world.

Perhaps JAX-RS 2.1 could explore built-in CORS support as a possibility?

Tuesday Sep 09, 2014

GlassFish Server Open Source Edition 4.1 Released!

GlassFish Server 4.1 Open Source Edition is available for download! This release of the world's first Java EE 7 application server includes multiple new and valuable features and updates. Here is a quick look at what's new:

  • Updated Platform Support.  This release adds support for Java 8, CDI 1.2, and WebSocket 1.1. GlassFish, the world's first Java EE 7 application server, maintains leading compatibility with the latest Java EE specifications.
  • Improved Developer Experience.While GlassFish 4.1 remains an open-source only release, quality and a productive developer experience remain a key focus.  GlassFish Server is made up of over 20 sub-projects (like Tyrus, Jersey, WeldEclipseLink, and more). Each of these projects adds features and bug fixes, over 1,000 in all! Thanks to those developers who participated in the GlassFish 4.1 FishCAT program to make GlassFish even better!  A special shout out to Joonas Lehtinen, who found a bug that caused GlassFish to fail to boot on Mac OS X 10.10 (Yosemite)!
  • New Features.  Here's a list of some of the most important updates in this release.
    • Tyrus (WebSocket 1.1 RI).  Now supports the WebSocket 1.1 specification, which adds a couple of APIs for improved support for Lambda expressions. Tyrus adds some features above and beyond the specification, like throttling the number of open sessions, metrics exposed through JMX, client reconnect, proxy support, optimized broadcasting of a message to all open sockets, and more. 
    • Jersey (JAX-RS 2.0 RI). Updated with some impressive new features. Jersey brings the OAuth support originally available in Jersey 1.1, and adds a new client-side API for OAuth 1 and 2 support. Jersey has also improved diagnostics with better error reporting, exposes Jersey metrics over JMS, and per-request tracing to a log file or to the HTTP reponse header. Jersey also adds client-side server-sent event reconnect support.
    • OpenMQ (JMS 2.0 RI). Open MQ adds support for communicating over WebSocket. There are two types of WebSocket clients that are supported. First, mqstomp, which adds support for any WebSocket client that supports the STOMP 1.2 protocol. Second, mqjsonstomp, which enables a (WebSocket) client to send JSON formatted messages using the STOMP 1.2 protocol. 
  • Java EE 7 SDK. The Java EE 7 SDK has been updated to make it more approachable overall. First, it is shipped as a zip bundle, offering a very simple installation process. The SDK also bundles GlassFish 4.1 and now supports Java 8. Last, the Java EE 7 SDK bundle includes updates to both the Java EE 7 Tutorial and Java EE 7 First Cup.

  • [Update] Netbeans 8.0.1 available for download; bundles GlassFish 4.0.1. 

In summary, GlassFish 4.1 offers updated platform support, improved developer experience, new features and is bundled in the refreshed Java EE 7 SDK. GlassFish 4.1 can be downloaded from, and the Java EE 7 SDK can be downloaded from the Oracle Technology Network (OTN). 

Monday Sep 08, 2014

Why Join the JavaOne GlassFish Community Events?

If you are active in the GlassFish community, you probably already know about the GlassFish community events that take place on the Sunday that kicks off JavaOne San Francisco. The event has long been the rallying point for the GlassFish community at JavaOne.

This year, the events are taking place from 10:00 AM to 11:45 AM. Our agenda is grouped into two separate sessions with a brief break in the middle:

To add to these sessions to your schedule, follow the session links above to the JavaOne Content Catalog and use the Schedule Builder widget on the top right hand side.

If you are a GlassFish user or even just a friend, this is the most important JavaOne event that you really should not miss, and for good reasons:

  • Learn the insider's view of Java EE 7, Java EE 8, GlassFish 4.1, GlassFish 5, community, success, metrics and roadmap for the future from none other than GlassFish product manager John Clingan himself.
  • Get a chance to listen to and interact directly with the Oracle Executives responsible for Java EE and GlassFish during the GlassFish Executive Panel.
  • Hear success stories from real world Java EE/GlassFish users and get to ask them your questions. This year Mohammed Taman will be sharing the story of the first known real world deployment of Java EE 7 on GlassFish 4. Mohammed will tell us about a highly innovative and important project he helped develop for the United Nations High Commissioner for Refugees (UNHCR) and the World Food Program (WFP). The project won the Duke's Choice Award for 2014.
  • Learn about the coolest features included in GlassFish from the GlassFish engineers themselves. This year key GlassFish engineer Martin Mares will be sharing the details on the GlassFish extensible command line framework.
  • Meet key members of the Oracle GlassFish team and community including Advocates, Architects, Java EE spec leads, and Product Managers.
  • Attending the event is one of the strongest ways you can show your support for GlassFish and Java EE under Oracle, get your voice heard and help shape the future.

Note that this is a JavaOne Sunday User Group session, so you will need a JavaOne pass to get in. Like all JavaOne events, there is a limited amount of registrants allowed for the session, so if you think this is something that is worth your while, you would be wise to pre-register via the JavaOne Schedule Builder as soon as possible.

Do check out the details for the event on the JavaOne Sunday Community Events Page, including the agenda, timings, panel question ideas, participant bios and story outlines. There's also the details on how to join the evening after-party.

You should also consider attending the GlassFish Birds-of-a-Feather session and a Birds-of-a-Feather session I am holding with the London GlassFish User Group on contributing to GlassFish - especially if you cannot make it on Sunday.

Friday Sep 05, 2014

JCP News (August)

Welcome to the third instalment of the JCP news focused on the server side. July was busy but August has been busy as well!

A lot of things has happened around Java EE 8 during August!

JSR 365: Contexts and Dependency Injection for Java 2.0 has passed has passed the EC JSR Approval Ballot. That means that the EG can now be formed and start to work on the specification!

In addition, the following new JSRs have been submitted for review (review closes on Sept. 8), they should then go to the EC for JSR Approval Ballot (Sept. 9-22):

  • JSR 366: Java Platform, Enterprise Edition 8 (Java EE 8)
  • JSR 367: Java API for JSON Binding (JSON-B)
  • JSR 368: Java Message Service 2.1
  • JSR 369: Java Servlet 4.0
  • JSR 370: Java API for RESTful Web Services (JAX-RS 2.1)
  • JSR 371: Model-View-Controller (MVC 1.0)
  • JSR 372: JavaServer Faces (JSF 2.3)

On the Java EE 7 front, 3 APIs are going through the Maintenance Release process:

And finally some quick updates on the JCP itself to conclude this August overview:

  • C2B2 has joined the JCP as a Corporate Member.  
  • JSR 364 (Broadening JCP Membership) has completed the Early Draft Review, a Public Review should be submitted in September.
  • The JCP EC Nominations will be open in September so if you have an interest in participating in the JCP EC, read this entry and get yourself prepared.
  • The nominations of the 12th Annual JCP Awards have been announced, the winners will be announced during the JCP Party at JavaOne (see here).