Dave Johnson on open web technologies, social software and Java
In my quest to make Roller work on Java EE 6, the first server that I decided to tackle was Glassfish 3. In this blog I'll describe how I approached the problem and what I learned along the way.
Roller uses JPA for persistence and specifically the Apache OpenJPA implementation. I knew that GlassFish uses the EclipseLink JPA implementation and I suspected that there would be JPA portability problems, so I decided to run Roller's JUnit tests against EclipseLink JPA. I wanted to find and fix those problems before even touching GlassFish. The tests ran and there were many JPA related failures and errors, most due to differences in the way that EclipseLink handles bi-directional relationships and the use of unmanaged objects.
Where OpenJPA is lenient about bi-directional relationships, EclipseLink requires you to manage both ends. For example, with OpenJPA you can get away with adding a bookmark to a folder with
folder.addBookmark(bookmark), but with EclipseLink you'd also have to add
Where OpenJPA is lenient about use of unmanaged objects, EclipseLink will complain bitterly whenever it finds one in a persisted collection or relationship. This was more of a problem in the tests than in the actual Roller code, which usually deals only with managed objects (i.e. those persisted to / loaded from the database and managed by the JPA implementation).
I was able to fix those problems easily and move onto the next step.
I also knew that Roller included some jars needed for Tomcat but that are not needed, or worse, problematic, on true Java EE servers. For example, we include the Apache OpenJPA implementation because Tomcat doesn't have one of its own. I modified the Roller build process to create two builds. One build is for Tomcat and includes OpenJPA and the other build is for Java EE and does not.
Next, I figured out how to deploy Roller to GlassFish 3 via the GlassFish web console, which was pleasant to use and familiar to me. I didn't run into any problems along the way and later I documented the whole process in the Roller 5 Install Guide (2MB PDF), with screenshots.
Next up: Roller 5 on JBoss 6