In my quest to make Roller work on Java EE 6, the next server that I tackled was JBoss 6. In this blog I'll describe how I approached the problem what I learned along the way.
Roller uses JPA for database storage and specifically the Apache OpenJPA implementation. I knew that JBoss uses the Hibernate JPA implementation and I suspected that there would be JPA portability problems, so I decided to run Roller's JUnit tests against Hibernate JPA. There were many test failures and fortunately, the failures were easy to fix.
Where OpenJPA is lenient, Hibernate JPA is strict about declaring transients fields as transient. So, wherever Hibernate complained, I added the appropriate transient declaration and soon all tests were passing. There were a lot of changes, but they were all trivially easy. Since I first "ported" Roller to ElipseLink JPA, its possible that some of the changes I made for EclipseLink helped with the port to Hibernate JPA.
Those of you who are familiar with Roller's history might remember that this is the second time I worked to make Roller work with Hibernate. Early versions of Roller ran on Hibernate until Roller 4, when we ripped it out because Apache policy does not allow LGPL. With Java EE 6, Roller can run on Hibernate and we don't have to ship the Hibernate jars to do so.
Since JBoss 6 is a Java EE 6 server, just like Glassfish, I figured I could use the same WAR that I created for Glassfish. That didn't really work out, as you will see below. When I attempted to deploy the Roller WAR to JBoss I ran into two problems:
When I tried to deploy the Roller WAR to JBoss, I ran into class-cast exceptions that indicated that the version the the Xerces XML parser included with Roller conflicts with the one that is included in JBoss. I encountered a similar problem for the JavAssist jars, which are also part of Roller. This was quite surprising to me. Apparently, JBoss uses Xerces and JavAssist internally and for some reason the JBoss internals bleed through and interfere with applications; seems like a bug to me. So, we have to have a special Roller WAR for JBoss without the Xerces and JavaAssist jars in the Roller WAR.
The next problem that I encountered was the datasource name. Roller uses the JNDI naming API to lookup its JDBC datasource. In all of the other app servers, we tell people to setup a datasource with the JNDI name 'jdbc/rollerdb' but that name did not work for JBoss. For JBoss, I could only get names of names of the format "java:/name" to work. Unfortunately, with JPA the datasource name must be embedded in the
persistence.xml file which is embedded in a JAR file which is embedded in the Roller WAR file. It's in there deep, so we have to produce a special Roller WAR for JBoss with a JBoss-friendly datasource name.
*Please* correct me if I'm wrong. I would love to be wrong about either of these two problems.
Due to those two problems, I modified the Roller build process to create a special Roller WAR for JBoss without the OpenJPA, Xerces and JavAssist JARs and with the JBoss friendly JNDI name
java:/RollerDS inside all included
Once I worked around those two problems, installing Roller on JBoss was easy. I did the whole thing via the JBoss web console, which was not familiar to me but was pretty easy to understand and use. I documented the whole process in the Roller 5 Install Guide (2MB PDF), with screenshots.
Next up: Roller 5 on WebSphere 8 (beta)
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.