lundi sept. 27, 2010

javaOne 2010 : Java EE 6 Panel "What do we do now?" notes

This blog has moved to
Follow the link for the most up-to-date version of this blog entry.

I was privileged to be moderating this year's Java EE panel at JavaOne (session 313278). We had a great list of panelists and a lively discussion. Here are my notes:

Panelists (from left to right)
• Adam Bien (individual)
• Jim Knutson (IBM)
• Emmanuel Bernard (JBoss, Red Hat)
• Reza Rahman (individual, Caucho)
• Krasimir Semerdzhiev (SAP)
• Roberto Chinnici (Oracle, spec lead)
• David Blevins (OpenEJB, Apache Geronimo)
• Alexis MP (Oracle, moderator)

Platform and API Adoption
JBoss is feature-complete (RC1) for the Web Profile, probably final in the Fall. Two more months before Caucho Resin is final. WebSphere is in Beta and WebLogic is working on it (GlassFish of course, has had a full implementation since the spec was released in December 2009).

Jim (IBM): adoption for JSF 2.0 (performance), servlet 3.0 and JPA 2.0 (mappings) seem to be very strong. Also JAX-RS (which unfortunately is not in the web profile and as such not part of the upcoming Resin 4 release). Krasimir (SAP) mentions EJB 3.x. Reza says people are very satisfied after studying Java EE 6. In some cases Java EE is back in people's radar. Emmanuel (JBoss): people like the consistency and tight integration of the platform. David (OpenEJB) : achievements with EJB's in WARs, singletons, asynch may replace JMS. Roberto (Oracle) on JAX-RS having helped REST become a mainstream technology for Java developers. Adam: migrated all his EAR's to WAR's, removed Quartz and replaced it with EJB Timer, removed a bunch of interfaces. RESTful resources as EJB removes layers, this is good. Event model in CDI is maybe one of the best features. Some of Adam's customers use EJB's and CDI without knowing that it's JavaEE which is the best possible sign that they're focusing on business logic.

CDI is a bit of a special case. Some think that it's powerful but that this power comes with complexity attached. Adam disagrees in terms of complexity of code (@Inject is really all you need to get started). JBoss/Emmanuel says that people are excited by CDI but portable extensions still not known by most. Jim: not that much demand for the time being, complexity might be causing some people to shy away from it but there is a lot of power there and adoption will come no doubt about it. Reza: the fact that it's part of the web profile is the reason they're certifying, also all Resin early adopters are coming for its CDI implementation. Need to re-align more of the platform in Java EE 7. Adam: CDI is like insurance, if there's a need for integrating additional frameworks, anything's possible with portable extensions, yet 90% of the projects don't need it. SAP: CDI is great but some people still haven't gotten their heads around Java EE 5 yet.

Java EE vs. Spring
Adam: I would never put Spring and Java EE together because there's too much overlap. Also from a business point of view, you'd need support from two companies (Spring and AS vendor) which typically don't like each other, so that's a big risk. Reza: there are a several reasons to integrate both: gradual migration, leveraging Spring's work (integration APIs). Adam replies that for new applications, there really should only be one as the injection styles overlap too much. IBM says it's hard to align technologies like Spring with the specification planing requirements, in particular JSR 330 does not quite allow for the integration of Spring, using a CDI-style of injection will offer greater fidelity. EE needs more work there. David Blevins says they're looking at a Guice implementation of CDI. Krasimir agrees that many projects do start from scratch so Java EE is the right choice.

Impact on tooling and testing
Krasimir: EJBContainer is a huge step forward. Emmanuel: tooling should help the developer and not be a requirement. For testing, JBoss has the Arquillian project (sort of next-generation Cargo), also works with GlassFish. David: would be neat to be able to inject resources in test code (OpenEJB working on that). Reza says trend in JavaEE is towards annotation and being more Java-centric (type-safe). Resin has no tooling plans but will integrate with Arquillian and is also developing and end-to-end testing solution. Adam: just use APIs, wizards are always suspicious and prevent people from using different tools (often the case in projects). Still looking for good unit tests (currently using junit 4, jmock, mockito). OpenEJB and GlassFish embedded help too. Roberto says that tools are also there to help people learn (NetBeans has a lot in store for that). Wizards also now produce clean annotation-based code if you decide to use them. Krasimir: tools are key because this is how most people experience and use the platform so they need to improve on a regular basis. Calling people to contribute to Eclipse. IBM: tooling evolved mainly in EE 5. Now more coverage with EE 6.

Questions from the audience
• CDI vs. JSF annotations (@ManagedBeans for instance) ? => Need to streamline some of this in future releases. CDI beans build on top of JSR 250 ManagedBeans. Need more of that throughout the platform.
• SpringMVC and CDI? => Technically possible: use CDI beans as controllers (but Reza says they're not seeing enough demand for SpringMVC to do the work).
• Java EE vs. Spring? => Reza: different approaches, make your own decision. Jim: don't reap out what works well. David: chose the platform you believe in and that will listen to you in the long run.

Roberto (see also his technical keynote for details): Cloud as a focus, modularity as enabler (built on top of what JDK will offer). Also need to track emerging technologies (WebSockets, HTML 5). Need to evolve the specification and not let it up to vendors to implement. Jim: JavaEE can mostly run in the cloud today, bigger problem is dealing with putting large app together: need a modules system. Krasimir: really wanted modules to be there in EE 6 so couldn't agree more. David: more generalization of the various annotations across the platform. Reza: modularity can't be the only value-proposition of, also need realignment of underlying technologies.

Java EE 6 is here today, go ahead and try it out!

vendredi sept. 24, 2010

Beginning Java EE 6 Hands-On Lab from JavaOne 2010

Following up on my previous blog post, my JavaEE 6 hands-on lab (S313277) with Mathieu from Serli was fully booked a few weeks before JavaOne so the organizers asked for a repeat which was scheduled only a few days before the conference start.

This repeat session filled out in a couple of days I believe. The content for that lab is heavily inspired by the "BeginningEE6" project which was initially developed as a companion to Antonio Goncalves' "Beginning Java EE 6 and GlassFish 3" book (2nd edition is now out btw and seemed like a best seller at the conference). This JavaOne Hands-On Lab was an introduction to some of the new features in the platform and is somewhat more polished (certainly the instructions are meant to be extensive).

You really can't do justice to Java EE 6 in a 2-hour lab with technical issues bound to happen, so it covered one improved API and two new Platform APIs: JSF 2.0, JAX-RS 1.1 and CDI 1.0. While has a link to the instructions document, you can also get its latest version from here (includes setup, three exercises and a troubleshooting section). Code can be found here.

JavaOne 2010 Technical Keynotes

I don't really attend keynotes to learn something new (it's pretty much my job to know this stuff before). Rather, I try to sense how people react by following tweeter tags and by being in the room. This year's JavaOne Technical Keynote with Mark Reinhold, Roberto Chinnici, and Greg Bollella was no exception.

For both Mark's and Roberto's part of the keynote, this was clearly split into two categories: the people that felt that covering plan A/B, JDK 7/8, project Coin, and all the great new features of Java EE 6 was really old stuff and those that we're genuinely excited by most of what they've heard. On the Java EE side of things I believe this was certainly the right balance.

Imagine that the vast majority of developers don't go to JavaOne, don't read blogs, don't tweet, and don't spend time downloading new open source projects and libraries. Yet, some people still found the so-called old content to be extremely useful. I certainly found the final thoughts on how Java EE should evolve for the cloud to be useful (watch the full keynote, not the highlights that trimmed the most important part :( ).

jeudi sept. 16, 2010

Another JavaOne around the corner

It's that time of the year again when the JavaOne excitement builds up with sleepless nights getting ready for the sessions, demos, etc... I am yet again looking forward to another very fine JavaOne conference.

To be fair I wasn't all that excited say a couple of months ago because of the changes made to the conference (different venue with Develop and Oracle Open World happening at the same time) and the anticipated lack of announcements but I can now say that the team has done a lot of work to make the venue a comfortable place (with the Zone, a huge tent on Mason street) and that content-wise, I expect a good number of things to cause long, possibly heated, discussions. This will only demonstrate how vibrant the Java community remains.

Of course there's the future of Java SE with Mark Reinhold's recent blog entry on proposed options for Java 7 and Java 8 (now with 171 comments!), the future of OpenJDK and where the Oracle JVM is headed but there's also a lot more announcements I expect to come out. I've been to most JavaOne's since 2000 (and blogged since 2004) and this once seems like one of the busiest for me.

Of course I'll be at the GlassFish Community Event and Party (Moscone and Thirsty Bear) and will attend Larry Ellison's keynote\* in between (I've been told that this first keynote is when he's the most entertaining).

I'll have a first run of the "Beginning Java EE 6" Hands-On Lab, will certainly not miss the JavaOne keynote\* at 5:45 and probably crash the OTN party in "The Zone".

With the jetlag still in effect I hope to be there on time for Thomas Kurian's OpenWorld keynote @ 8am. The JavaOne Technical keynote\* is planned for 2:30pm that day with Roberto Chinnici (Java EE spec lead), Mark Reinhold, and other Java architects. As it stands, the evening will be packed with receptions and parties.

I'll be running the Java EE 6 "What do we do now?" panel at 10am with a great set of participants. Larry will be up again speaking at 3:15pm. I'm hoping this is the day I get to attend most sessions (still need to inject those into my agenda).

The "Java Frontier" keynote\* kick off at 9am with Ray Kurzweil and others. I then have another round of the Java EE 6 Hands-On Lab before I run to catch my plane home.

\*: Streaming of all keynotes and general sessions will be available from this page (should also be linked from this page).

There will be lots of Java EE and GlassFish-related content. Check out this post on TheAquarium for the details. Full list of sessions is here. If you're going to the conference or simply want to interact with people going there, try this tool. See you there virtually or in person.

Ok, now back to prep work.

vendredi juil. 23, 2010

Module initialization order in Java EE 6

This blog has moved to
Follow the link for the most up-to-date version of this blog entry.

One of the new features in the umbrella Java EE 6 specification is the ability to define the order in which modules (web applications for instance) from a given Java EE application are initialized by the container. This might be useful if you want for example a given module to serve as resource initializer to create a database table before any other module can be accessed (note this does not apply to application client modules). Previously, the order in which Java EE application modules were initialized was unspecified and by default this is still the case in Java EE 6.

To explicitly request modules to be started in a particular order, the application should use <initialize-in-order>true</initialize-in-order> in the the EAR's application.xml deployment descriptor. The container will then start the modules in the order they are declared in that same configuration file (note that application.xml is optional by default and should be placed in the EAR's top-level META-INF/ directory). The short example below shows an EJB singleton creating a database table upon creation and dropping it before destruction. With this setup, the database table should always be accessible to the web application. (a singleton packaged in OrderMatters-ejb.jar) :

public class InitDB {
     void createDBtable() {

     void dropDBtable() {

The application.xml deployment descriptor for OrderMatters.ear :

<application version="6"

Full details are available in the Java EE 6 platform specification, section EE.8.5.4. Of course you can use this today in GlassFish.

As an alternate solution if you're willing to use features in GlassFish 3 beyond what Java EE 6 provides, you may also solve the problem by breaking the application into different OSGi bundles and using a combination of BundleActivator and ServiceTracker as shown in this sample from Sahoo). This can in some cases offer a more suitable and loosely-coupled approach.

dimanche mai 09, 2010

EJB 3.1 asynchrony and transactions

This blog has moved to
Follow the link for the most up-to-date version of this blog entry.

When presenting Java EE 6 and GlassFish v3 at the Lausanne JUG last week I was bombarded with questions (I like that) and I think I didn't do an ideal job answering the following question (paraphrasing) :

How does the new async feature in EJB 3.1 work wrt transactions?

The precise answer is easy to find in the EJB 3.1 specification itself (paragraph 4.5.3) :

Client transaction context does not propagate with an asynchronous method invocation. From the Bean Developer’s view, there is never a transaction context flowing in from the client. This means, for example, that the semantics of the REQUIRED transaction attribute on an asynchronous method are exactly the same as REQUIRES_NEW.

By the way, the entire section on EJB 3.1 asynchronous methods is only two pages.

mercredi avr. 28, 2010


This blog has moved to
Follow the link for the most up-to-date version of this blog entry.

Modularity is one of the themes for Java EE 6 and servlet 3.0 fragments one often mentioned as one examples of this (see details here). This blog entry is about a small yet very useful new feature of the servlet 3.0 specification to deal with static content such as images, CSS or JavaScript.

Before servlet 3.0, images could be made accessible from the root of the web applications but that meant copying the files to the WAR archive and keeping them up-to-date. This certainly meant a solution tightly coupled with the web application development and packaging. The other option was to place this static content in the docroot of the application server which was in turn time probably too loosely coupled allowing for anyone to access this and encouraging every application to use the same set of static content.

With Servlet 3.0, a JAR placed in WEB-INF/lib has static content from its META-INF/resource directory accessible from the web-context root. You can also parse this previous statement with WEB-INF/lib/{\*.jar}/META-INF/resources. So this means you no longer need to use the ServletContext getResource() and getResourceAsStream() methods with some rather dumb rewriting.

In this simple web application WAR example :

... the static resources are available from :


where http://host:port/webcontext/ could be replaced with the relative path "./"

This makes for more modular applications. Other than images, think of how this applies to CSS and javascript. It's probably now a good idea to package JavaScript libraries such a jquery or dojo in a dedicated JAR (effectively a resource JAR).

The other use-case I can think of is configuration files. One could deploy with WEB-INF/lib/testing.jar or with WEB-INF/lib/production.jar each of which containing META-INF/resources/ file with different content. The application code reading the configuration would always access it using ./ (or http://host:port/webcontext/

Note this mechanism also applies to JSPs and that resource files placed in the document root take precedence. Get all the details from paragraph 10.5 of the Servlet 3.0 specification.

Try this out today in GlassFish 3 and above.

lundi févr. 08, 2010

GlassFish , Kenai, and HotSpot under the Oracle Sun

It's been just over a week since Oracle held its post-acquisition stategy webcast and we've already seen some fast reactions and comments from Oracle on several topics :

• Projects hosted on Kenai will preserve their infrastructure and be moved to (the best of both worlds if you ask me). See Ted Farrell's post for the details.

GlassFish has seen an interesting set of reactions most of which worried about the wording used during the launch event. Mike Lehmann, WebLogic PM discusses here and there the situation and the likelihood of GlassFish v3 getting HA/Clustering capabilities in the near future. That's Mike's 1st post on TSS btw! I think that means he cares about GlassFish ;)

• On the JVM side, people have been asking question about HotSpot vs. JRockit and Henrik Ståhl, JRockit PM offered a first insight into what it would mean to have a combined product in the long run (also covers OpenJDK).

Overall, it's great to see Oracle reacting quickly to the community's concerns and I think one should judge the work of the combined teams (Sun and Oracle could not talk about future plans before January 27th) on the roadmaps and the execution. Remember, the proof of the pudding is in the roadmap!

mercredi févr. 03, 2010

Le Paris JUG a deux ans!

Ne faites pas comme moi, ne loupez pas si vous êtes sur Paris la soirée pour fêter les deux ans du ParisJUG le 9 février 2010 dans le 17ème (attention c'est pas la Sorbonne du quartier latin...).

Antonio et la bande on préparé une belle soirée avec Sacha Labourey (que j'ai déjà raté lors de son premier passage) comme intervenant dans la séance plénière. Je regrette beaucoup de ne pas pouvoir être là, je pense que mes oreilles Sun/Oracle vont siffler ;)

Je compte bien suivre la soirée sur Twitter (juste pas jusqu'à la fin du resto ou de la quatrième mi-temps orchestrée sans doute par Cyril & co. :)

mardi nov. 24, 2009

Back from Devoxx 2009 (a JavaEE 6/GlassFish v3 perspective)

This was Devoxx' 8th edition and my personal 5th (I think).

I think the Java EE 6 and particularly GlassFish v3 were very well received at this year's Devoxx 2009 conference. Of course some of it has to do with the fact that both are almost final (Java EE 6 spec lead Roberto Chinnici announced at the event that it'll be done on December 10th 2009). But I like to think that there's much more to it.

The Java EE 6 session that Antonio Goncalves and myself ran as a university 3-hour talk was packed and (this is the real test), all came back after the break. We went through 12 or so demos (with minimal failure I should say) from a simple managed beans to a working application with JSF 2, Servlet 3.0, JAX-RS 1.1, JPA 2, EJB 3.1 (including testing, Antonio's favorite). It seems that people enjoyed the level of information and the step-by-step approach. As any other talks at the conference, this one should be made available on parlays (for a fee) real soon. We're working to make to code for the samples available one way or another. Stay tuned. Update: the session is now live on Parleys: Part 1 and Part 2. Antonio's 1-hour talk is here. All talks are for a fee.

The Java EE BOF (a last minute addition) was packed and a good moment, and to me what BOF's should look like (too many people use it do deliver regular PPT-based presentations). With a panel of JSR and project leads, the discussion centered around availability of Java EE 6 implementations, new features such as managed beans and JSR 299, how JSR's can produce multiple specs, etc... Nice interactive crowd. The speaker's diner that evening was an occasion to meet Oracle's Steve Harris, the keynote speaker for the next morning.

The first "conference" day had three keynotes : Oracle, Sun, and Adobe. The feedback on Oracle's keynote via tweets, blogs, and discussions wasn't so good but I think that with the given circumstances it made clear that Oracle cared and was no stranger to how the Java community is structured, how it evolves, and what the challenges are. The demos were what people remembered it seems. Sun's keynote was given by Roberto and Ludo (already available on Parleys) and, in 30 minutes, covered Java EE 6 and demoed GlassFish v3 - fast startup, deploy on change, preserve session on redeploy, and OSGi bundle invocation straight from a servlet were all shown in only a few minutes. I think that this is the first conference in a while where people don't ask me about GlassFish's future (and I did talk to many people during the event). This is both the result of what they saw and of the recently updated FAQ by Oracle.

JBoss was pretty well represented this year but for some (planning?) reason there was no dedicated talk on JSR299. It was certainly very nice to see JBoss strongly supporting Java EE 6 (beanvalidation, 299, JSF 2, etc...). Other highlights for me at the conference were the JDK 7 closure proposal, project Lombok looks interesting (including in a Java EE context), not quite convinced by Gradle (Maven 3 releasing in January may steal its thunder), and Kees Jan's monitoring/performance talk was pretty good. I'm amazed to see the number of people attend those performance talks - the GC is no longer the issue and there hasn't been any technology or performance tool break-through in a while (btrace is the only thing that comes close and Simon covered that). Clearly SOA is disappearing from the agenda year after year (although people had good things to say about SOA in Practice session), and leaving room for the cloud talks.

lundi nov. 09, 2009


This blog has moved to
Follow the link for the most up-to-date version of this blog entry.

You might have heard of "managed beans" before, but chances are these will be new to you. These are not specific to JSF and not related to JMX in any way. Rather, Java EE 6 specifies Managed Beans 1.0, or lightweight components.

Managed beans are plain old java objects whose life-cycle is governed by the container (allowing for creation and destruction callbacks) and supports resource injection (and of course can themselves be injected). To define a managed bean, you simply need to annotate a class with @java.annotation.ManagedBean. You can apply the existing (JSR 250) @PostConstruct and @PreDestroy annotations to methods in that bean and inject resources using @Resources (as well as with @EJB or @WebServiceRef). Here's a simple example :

public class MessagesBean {
    TranslationBean localizer;

    public void myInit() {
        System.out.println("\*\*\* Constructed!");
        // Do something useful

    public String getTranslatedMessage(String message) {
        return localizer.translate(message);

Such a class can then be deployed within a WAR, an EJB-JAR or an ACC-JAR and can be injected within another Managed Bean, a servlet, an EJB or a JSF Managed Bean using a simple @Resource MessagesBean bean; statement. Life-cycle and injection in itself is nice but it gets even better with interceptors which can also be applied to managed beans (no longer to just EJB's) :

public class MessagesBean {

Whether Managed Beans will be used directly by application developers or mostly for building higher level abstractions such as EJB's (transactional managed beans in a sense), JAX-WS endpoints (SOAP-enabled managed beans) or JSR 299 is yet to be defined. You decide.

You can of course try all of the above in GlassFish v3.

samedi mai 02, 2009

SDPY - Java EE 5 is 3 years old

Java EE 5 is 3 years old. GlassFish v1 will hit the same milestone in a few days.
Java EE 6 and GlassFish v3 are scheduled for the fall with an interim release of the app server at JavaOne next month.

dimanche avr. 26, 2009

Antonio's book on Java EE 6 (and GlassFish v3)

Antonio Goncalves seems to have just shipped his work for his new Java EE 6 book. It sounds like the very first one to cover this topic which is quite a challenge given the specification will be final only in a few months. In the mean time, I wish Antonio the best for JavaOne sales! He's certainly very well positioned to write such a book - at the heart of the matter, yet not a "vendor" but rather a exemplary Java community member.

GlassFish v3 as covered in this book (great to have GlassFish be part of the title!) is also a moving target since "Prelude" was released last year with a Java EE 5 web container and previews of EJB 3.1 and JSF 2.0 available via the update center. In the mean time, only promoted builds of the Java EE 6 work have been made available, so I hope Antonio will have a chance the refresh the content when Java EE 6 and GlassFish v3 ship later this year in a second edition of the book.

lundi janv. 19, 2009

Random Java performance podcast comments

I was recently listening to this JavaWorld podcast on Java scalability and was surprised to hear a few things (hopefully well paraphrased here) :

"Java is not the best choice given its threading model and synchronizing". I just don't understand that statement. Still Java 5's concurrency API is still under-used by many IMO.

"30 seconds GC pauses are common". Really? This sounds like 2000. Are you still seeing GC pauses above 10 seconds? There's now multiple GC algorithms to chose from and default options now provide really good performance in a large majority of setups.

"Real-time Java is around the corner and will fix many latency issues". Real-time java is really not the issue to most web site scalability or latency issues. Maybe the garbage-first GC scheduled for Java 7 will be an easier answer than the current required JVM tuning.

"ORM's are not needed, straight JDBC is better for scalability". I can't help but think that this can apply to only a handful of popular web sites. For everyone else, frameworks like JPA are just no-brainers.

"More generally speaking, frameworks are bad for performance and scalability". I think some stack-traces can be indeed intimidating. Frameworks should strike a good balance between productivity and out-of-the-box performance. Tuning expertise for a given framework is usually a function of the popularity of that framework while some popular frameworks are known to have scalability issues.

"Application servers are not a good idea because they mix business logic and web requests... a JVM should suffice". I am a strong believer in multi-tiered architectures and stateful applications so this sounds very wrong to me. The notion of a container is one of the most important break-through in recent years for productivity, transactions, persistence, and scalability. Clearly I don't buy or even really understand this assertion.

Performance and scalability objectives can justify to de-normalize the architecture (much like you would for database schemas) but while this podcast has value, I don't believe most developers should follow every recommandation in this podcast right off the bat.

vendredi janv. 16, 2009

Two JUG events in two days

I presented on Tuesday at the Paris JUG. As previously reported by JBoss' Sacha, this JUG is really doing well - great attendance (200+ every single month), very fine question during and after the the talks, and several people reporting in details what they heard and learned in various blogs (this one for instance). Luckily the beamer Gods were with us and almost all demos worked. Antonio Goncalves (JUG leader, book author, and JSR EG member) presented on Java EE 6 before I took the stage with a GlassFish v3 Prelude presentation. The combination of compile-on-save, deploy-on-change and session preservation across redeployments was what most people liked it seems. From the questions and comments I think more people realize that in those difficult times, the Open Source application server alternatives are very real and that GlassFish has a lot of thinks going for it.

On the next day I was at the inaugural Riviera JUG meeting. Not as crowded as the Paris event but some very good discussions. The Lunatech Research guys (organizing the event and the JUG) are clearly very JBoss-friendly but I think I got them pretty excited about GlassFish (the question during diner was along the lines of "should we switch to GlassFish?"). There were several technical questions asked (OSGi, session preservation, etc..) and a business one around the commercial (I wish I could share all the customer wins, some are really significant...). eXo's Julien Viet did a nice presentation with a full section on integration between portlets and various web frameworks. With his JBoss background and connections he's of course always an interesting guy to talk to even if I'm not sure I agree with his analysis "JBoss has a superior kernel design" assertion! :)

Time spent in JUG meetings as a speaker or as an attendee seems to be always well spent! Slides are posted here:

Blogs on the Paris evening (in French): #1, #2, #3, #4


This blog has moved

Alexis Moussine-Pouchkine's Weblog

GlassFish - Stay Connected


« juin 2016

No bookmarks in folder


No bookmarks in folder