Copying resources to JBoss with Maven

In my project, we use Maven to compile, build, package and deploy our application to JBoss 4.3. Every works fine. But each time a new developer comes along, or when we need to install a new server, we always have to remember to deploy the datasource and copy the MySQL JDBC Driver to JBoss. Nothing too complicated, but we tend to forget it. The file myproject-ds.xml defining the datasource needs to be copied to JBOSS_HOME/server/default/deploy and the mysql-connector-java-5.1.6.jar file needs to be copied to JBOSS_HOME/server/default/lib. To do that, we had an Ant script but people didn’t like the idea of using both Maven and Ant. So, why not using Maven profiles and the maven-resources-plugin to copy these two files to JBoss. The idea is to use an Initprofile to initialize JBoss (by typing mvn -PInit install). This will copy the files only once to JBoss. Then, the maven-resources-plugin can be used to copy the myproject-ds.xml (which is under the src\main\resources directory) and the MySQL driver (located in the local repository). So, with a bit of Maven knowledge, a little help from my friend Arnaud and a lot of trying, here is what I came with : Make sure you have the JBOSS_HOME variable set as this script uses env.JBOSS_HOME. The ${settings.localRepository} points to your local Maven repository. When I look at these 52 lines of XML that copy two files in two seperate directories, I either think that I’ve missed […]

Read More →

JCP.org has a new website

This morning I didn’t see any blogs talking about it, so I thought I should say something. As a JCP member I receive a newsletter with some news of the JCP. One of them is that the jcp.org web site has changed. So here are the novelties : The new site is more efficient, enables personalized content, and enhances participation, communication, and transparency.  The url is the same, but the site has many new features including personalization, discussion boards and wikis. For a user point of view, the main difference is the skin. The menus to look for a JSR are the same. But as a member things have improved. Another signal from the JCP to add more collaboration to their process.

Read More →

Dédicace du livre Java EE 6

Aujourd’hui, les exemplaires du livre Java EE 6 sont enfin arrivés en Europe. J’ai reçu ma petite collection privée de 20 exemplaires ainsi que tous les bons libraires informatiques parisiens. Alors, si vous faites partis des quelques rares qui n’ont pas encore ce best-seller, je vous propose de nous retrouver samedi 20 juin à la librairie Le Monde En Tique […]

Read More →

Java EE 6 book at JavaOne

Hurrah !!! My book physically exists. It was printed last week and is available at JavaOne. So guys, look for the book shop in the Moscone center, and ask for the already best-seller Java EE 6 book. You can’t miss it. It has been published by Apress (it’s black and yellow) and, as you can see on the photo, it’s […]

Read More →

JSR 330

Just a quick news. For those of you who have followed the entire debate between JCDI (Java Context & Dependency Injection, aka Web Beans) and @Inject, you will be pleased (or not) to know that there is a brand new JSR : JSR 330 Dependency Injection for Java. I hope we are not starting a new battle like the one between Java Module (JSR 277), Modularity Support (JSR 294) and OSGi. Future will tell.

Read More →

Bienvenu chez le Ch’ti JUG

Dans la famille Présentation Java EE 6, je voudrai les Ch’tis. Qques jours après mes présentations GlassFish et Java EE 6 à la conférence GeeCon à Cracovie, ce soir je me suis rendu à Lille pour présenter les nouveautés de la future plateforme entreprise. Dernier en date de la longue lignée des JUGs français, le Ch’ti JUG était inauguré ce […]

Read More →

GeeCon is over, long live GeeCon

As I mentioned a few weeks ago, I’ve been invited to GeeCon to talk about Java EE 6. This very first edition of GeeCon took place in the city of Crakow and was aimed at Eastern European Java developers. The Polish JUG was created a few years ago as a local Java event user group. This year they decided to […]

Read More →

A book about Java EE 6

If I haven’t blogged for a long time, that’s because I was busy writing a book about Java EE 6. As some of you already know, I’m expert member on various JSRs, including Java EE 6. Last year I have been approached by Apress who proposed me to write a book about Java EE 6 in the From Novice to Professional collection. At first I wasn’t sure because I’ve already written a book and know the workload that it represents. But I’ve been a reader of Apress books for a long time, an appreciate them. I was finally convinced to participate to such quality books. So here it is : Beginning Java™ EE 6 Platform with GlassFish™ 3: From Novice to Professional. Well, actually the book is gone to printing and will be published end of May. So stay tune, and be ready to buy a copy of it (or an ebook version). The book focuses on the novelties of Java EE 6 and covers most of the specifications. 450 pages structured as follow : Chapter 1 briefly presents Java EE 6 essentials and the tools used throughout the book (JDK, Maven, JUnit, Derby and GlassFish v3). The persistent tier is described from Chapter 2 to Chapter 5 and focuses on JPA 2.0. After a general overview with some hands-on examples (Chapter 2), Chapter 3 delves into the object-relational mapping (mapping attributes, relationships and inheritance). Chapter 4 shows you how […]

Read More →

Java EE 6 at the GeeCon conference

I’m proud to announce that I’ll be talking at the GeeCON conference about Java EE 6. Proud because this conference is the first edition and has been created by the Polish JUG. A few months ago, Grzegorz Duda asked me if I was interested in speaking there. I’m always ready when it comes to talk for JUGs. GeeCON is a […]

Read More →

Looking for Java EE 6 expert members to organize a BOF at Jazoon

Jazoon, the international conference on Java technology, will be held in Zurich from the 22nd to the 25th of June. For four days you will have the chance to go to many technical presentations, with good speakers and also plenty of BOFs. I‘ve sumitted a talk on Java EE 6 and I‘ve also submitted a BOF on the same topic. The BOF is called Why should I care about Java EE 6 ? The idea is to meet informally with expert members or spec leads around Java EE 6 (EJB, JPA, JAX-RS, JAX-WS…). Developer, architects, project leaders who wantsto know more about Java EE 6 could come and share their questions and comments with Java EE 6 experts. To hold this BOF, I‘m looking for other expert members or spec leads who will be at Jazoon. If you are interested, drop me an email so we can try to make this BOF happen.

Read More →

Everybody should be able to easily observe JSRs

This year I‘ve talked a lot about opening up the JCP. I first did a round table at QCon with Rod Johnson and Patrick Curran (chair of the JCP) back in February. Then at Java One (with the same folks) and in May Patrick Curran came to the Paris JUG … and now a BOF at Devoxx with Corina Ulescu about this sensible topic. The questions are always the same : should the JCP be more open, and how ? To the first question, I think that most of the people agree. Yes, the JCP should be a more transparent organization. But to which extent should we open it ? And if we find a solution, do we have to formalize it and impose it (that means changing the JCP process). Basically, a spec lead can decide of the tools he/she wants to use. If he/she wants a public mailing list, that‘s fine, if not, that‘s fine too. The JCP does not impose a spec lead a way of communicating. So, at the moment, there‘s a bit of everything : closed JSRs (no wiki, no public mailing list…), opened ones (open source reference implementation, open mailing list…), and anything in between. But which model to choose ? I have to say, I‘m between two waters here. I‘m expert member on JSR-316 (Java EE 6), JSR-317 (JPA 2.0) and JSR-318 (EJB 3.1), that‘s a lot of work. Every day I receive […]

Read More →

Genesis, EJBs… it depends which version

I have two passions : Java and Music. And recently, I faced a common problem while trying to explain Why I love EJBs and Why I love Genesis When I say I love Genesis, I’m talking about the version 1.0 of the band. The one from 1967 to 1975 (even 1977) when it was a progressive rock formation. Then Peter Gabriel left, Phil Collins stopped playing drums, started singing, and that was the end of Genesis V1.0 (with tracks like Supper s ready or albums like Selling England by the Pound ) and the beginning of 2.0 (Invisible Touch, We Can‘t Dance…). When I say I love EJBs I’m talking about Version 3 not V1 or V2 from 1998 to 2006 when it was a heavyweight model. Phil Collins should have renamed the band, and the JCP should have renamed their component model. Talking to people would be easier.

Read More →

Tutorials on Java EE 6 testability

Unit testing is an important topic in projects. J2EE has suffered from a lack of testability and, clearly, got overtaken by light open source containers. Java EE 6 is taking that into account and unit testing an EBJ, for example, will be simple and standardised (through a embeddable container API). As Roberto Chinnici mentioned on his blog, Java EE 6 is scheduled for Q1 2009… but reference implementations are already on there way. So I‘ve decided to write a series of tutorials focusing on testing Java EE 6 components. The first one is about testing an entity with Eclipse Link (the reference implementation of JPA 2.0). It uses MySQL, Embedded Derby, Maven, JUnit and DbUnit. Read the tutorial Testing Java EE 6 components : JPA 2.0

Read More →

A brief history of Object Relational Mapping

The other day I was at a bar talking to a friend about Entity Beans CMP. We both agreed that, today, this ORM model is crap. But he said, at the time it was created, it was the best we could do In general I would agree with that. We can’t say that the plane of the Wright brothers was crap. Compare with today, it is, but at the time, it was revolutionary. Were Entity CMPs revolutionary ? No, because it wasn‘t the very first ORM model. There was TopLink before. Here is a brief history of ORM 1994 : The product TopLink for Smalltalk was sold 1996 : a Java version of TopLink was added to the product line, named TopLink for Java. 1997 : 3M was the first company to officially buy TopLink for Java. 1999 : TopLink for Java receives a Java Report award 1999 : TopLink for WebLogic was developed and based on POJOs 1999 : The JSR 19: Enterprise JavaBeans 2.0 specification is initiated 2000 : JSR 12: Java Data Objects specification is initiated 2000 : After the joint acquisition of The Object People in April 2000 the consulting (non-TopLink related) division was sold to BEA, and TopLink was sold to a new startup called WebGain. 2001 : The JSR 19: Enterprise JavaBeans 2.0 is released in september 2001 2001 : The JSR 153: Enterprise JavaBeans 2.1 is started (bringing Web Services support and a […]

Read More →

Java EE 6 Reference Implementations

Java EE 6 (JSR 316) is arriving quickly (Q1 2009). With most of the specifications, comes a TcK (Technology Compatibility Kit) and a reference implementation (RI). Here is the list of the main reference implementations : .GlassFish V3 is the reference implementation for EJB 3.1 and Servlet 3.0 .EclipseLink : Java Persistence API (JPA 2.0) .Jersey : Reference Implementation for building RESTful Web services (JAX-RS 1.0) .Metro : Web Services (JAX-WS 2.2) .JBoss Seam for Web Beans 1.0 .Mojarra for JSF 2.0

Read More →

Java EE 5, second edition

The first edition of my Java EE 5 book has been sold out ! In fact it’s 2500 copies that have been sold in 14 months. It doesn’t sound much like that, but remember that it’s written in French (much smaller market than the English one) and talks about evil technology : EJB ! So, it’s a best seller (JK Rolling , if you read this blog, be prepare to suffer high competition). Eyrolles, my editor, asked me to prepare a second edition, and that‘s what I did last spring. So here it is, the second edition just came out with some new stuff. Of course, I used this second edition to update references, software version and correct some erratums. I also add new definitions and gave more explanations and clarifications on several topics (based on the feedback I received). And I add new paragraphs on new topics : more about GlassFish, GlassFish admin tasks (such as asadmin), and GlassFish configuration on JPA I explain how to persist an object in more than one table, the many to many relationship and inheritance. There is also more information about JPQL I‘ve also add more on application client container (ACC) more on JAXB2 and XML mapping and a new full chapter about how to create a Java EE 5 applications with Intellij Idea So if you know how to read French and want to know more about Java EE 5, just do […]

Read More →

Back from the TSS Symposium in Prague

Last Wednesday I‘ve landed at noon in Prague, quickly took a taxi, arrived at the Clarion Congress Hotel where the conference well held, registered, went to my room and had a quick last look at my slides. At 3:50pm I was giving a talk on Building Enterprise Applications Using Glassfish . It was about installing GlassFish, deploying an application, monitor […]

Read More →

Primary and secondary table with JPA

It‘s the third time I‘ve been asked if in JPA you can persist the attributes of your entity in several tables. The answer is yes. It has a performance impact (each simple query will use joins) but it can be very helpful when you need to map your objects into an existing database. Here is an example of an Address entity that persist its data into a primary table (t_address) as well as two secondary tables (t_city and t_country). The primary table can be customized with the Table annotation and the secondary with SecondaryTable or SecondaryTables (with an 's') if more than one. Then it's just a matter of explicitly using the Column annotation on the attributes you want to persist in the secondary tables (@Column(table=“t_city”) would tell JPA to persist this particular attribute into the t_city table). By default the attributes are persisted in the primary. @Entity @Table(name = "t_address") @SecondaryTables({ @SecondaryTable(name="t_city"), @SecondaryTable(name="t_country") }) public class FirstTable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String street1; private String street2; @Column(table="t_city") private String city; @Column(table="t_city") private String state; @Column(table="t_city") private String zipcode; @Column(table="t_country") private String country; } As a result of that, you will get three tables with the following columns : t_address : id, street1, street2 t_city : id, city, state, zipcode t_country : id, country Notice that the id is replicated in each table.

Read More →

Speaking at the TSS Symposium

Soon (18–20 June) starts the TSS Symposiumconference in Prague. A great conference with good speakers in a beautiful city. Well, this time I‘ll be speaking there. In fact, I‘ll be giving two talks : Building Enterprise Applications Using Glassfish . I‘ll talk about administrating GlassFish instances in general and in a cluster in particular. In this session, you will learn […]

Read More →

A virus at JavaOne

Today I only attended two presentations and had to leave the conference for some rest. I wonder if I‘m just exhausted about too much JavaOne, or if I‘ve got a virus. This is the email that we received this morning : URGENT PUBLIC HEALTH ADVISORY FROM JAVAONE TEAM The JavaOne conference team has been notified by the San Francisco Department of Public Health about an identified outbreak of a virus in the San Francisco area. Testing is still underway to identify the specific virus in question, but they believe it to be the Norovirus, a common cause of the stomach flu, which can cause temporary flu-like symptoms for up to 48 hours. Part of the San Francisco area impacted includes the Moscone Center, the site of the JavaOne conference which is being held this week. We are working with the appropriate San Francisco Department of Public Health and Moscone representatives to mitigate the impact this will have on the conference and steps are being taken overnight to disinfect the facility. We have not received any indication that the show should end early, so will have the full schedule of events on Friday as planned. We hope to see you then.

Read More →

JavaOne : a nostalgic portuguese touch

It is my first JavaOne, so I can‘t really compare. But something tells me that 5 years ago JavaOne was about… Java. Today, it feels different. There are plenty of technical sessions about other languages and on the top selling books at JavaOne, three are about other languages (Groovy and JavaFX). Even James Gosling talked about Scala . And I […]

Read More →

JavaOne : Opening up the JCP

Today was an interesting day at JavaOne. I first started meeting a giant Duke in the busy corridors of the Moscone Center Then I met Aaron Houston (the Sun guy who helps the JUGs around the world) who gave the Paris JUG a Sun Spot . The idea is to use the spot in a collaborative way so the JUG […]

Read More →

JavaOne : My Top 3 Issues

Today it was JavaOne‘s kick off. It started with a keynote with Rich Green. It was concentrated in mobile devices (Amazon presented its Kindle eBook) and, of course, JavaFX took a big place. I‘m still a bit sceptical about JavaFX but Rich Green said that really soon it will be running everywhere, in all kind of mobile devices. And then […]

Read More →