Dave Johnson on open web technologies, social software and software development
« Latest Links | Main | Latest Links »
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 bookmark.setFolder(folder)
.
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
Dave Johnson in Roller
12:29PM Jan 10, 2011
Comments [5]
Tags:
asf
glassfish
java
javaee
jpa
« Latest Links | Main | Latest Links »
This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog
Below are the most recent entries in the category Roller, some may be related to this entry.
Posted by Alexis MP on January 10, 2011 at 09:15 PM EST #
Posted by Harald Wellmann on January 22, 2011 at 07:40 PM EST #
Thanks for the comments!
Harald, I tried including OpenJPA in the Roller WAR at one point and ran into problems that I decided not to solve. I wanted to to get Roller working on "native" JPA implementations. Now that I know you've make it work before, I will give this another try.
Have you also tried OpenJPA, Hibernate and Eclipselink on JBoss and other apps servers?
Cheers, DavePosted by Dave Johnson on January 22, 2011 at 07:51 PM EST #
Posted by Michael Müller on February 06, 2011 at 07:05 PM EST #
Hi Michael,
I don't do support here on the blog. If you want help then please take your Roller questions to either the Roller User or Developer Mailing Lists here:
Roller Mailing Lists
That's the best way to reach the widest audience of people who might be able to answer your question and benefit others who might have the same questions or problems in the future.
Thanks, DavePosted by Dave Johnson on February 08, 2011 at 12:04 PM EST #