« Latest Links | Main | Latest Links »

Roller 5 and JBoss 6

JBoss logo 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.

Tested with Hibernate JPA

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.

HIbernate logoThose 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.

Tried using the Java EE version of the Roller WAR

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:

Problem 1: Xerces and JavaAssist

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.

Problem 2: JNDI Datasource Name

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.

Created special Roller WAR just for JBoss

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 persistence.xml files.

Deployed, tested and updated the docs

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)

See also: Roller 5 and Java EE 6 and Roller 5 on Glassfish 3.


What kind of Javassist issue are you seeing?
(can you push the post to our JBossAS forum, and just link it here)

As I quickly hacked a simple .war, which uses bundled Javassist, and I have no issues:

Inside my servlet code:
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		response.setContentType( "text/html" );

         ClassPool pool = new ClassPool();
         pool.appendClassPath(new LoaderClassPath(getClass().getClassLoader()));
         CtClass ctCass = pool.getCtClass(getClass().getName());
         System.out.println("ctCass = " + ctCass);
         System.out.println("Javassist used in this .war=" + ctCass.getClass().getProtectionDomain().getCodeSource().getLocation());
      catch (NotFoundException e)
         throw new IOException(e);
with the output:

12:16:46,779 INFO  [STDOUT] ctCass = javassist.CtClassType@3cffc6ae[public class org.jboss.test.isolation.IncomingServlet extends javax.servlet.http.HttpServlet fields=org.jboss.test.isolation.IncomingServlet.manager:Lorg/jboss/test/isolation/UserManager;,  constructors=javassist.CtConstructor@3c4ce8cb[public IncomingServlet ()V],  methods=javassist.CtMethod@baff1e60[public doGet (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V], ]
12:16:46,779 INFO  [STDOUT] Javassist used in this .war=vfs:/Users/alesj/projects/jboss6/trunk/build/target/jboss-6.0.1-SNAPSHOT/server/default/deploy/hib-in-war-1.0-SNAPSHOT.war/WEB-INF/lib/javassist-3.12.1.GA.jar/

Posted by Ales Justin on January 20, 2011 at 09:25 PM EST #

For the problem #2, can you provide a bit more details on what's failing? Preferably, a forum thread here http://community.jboss.org/en/jbossas?view=discussions would help.

Posted by Jaikiran Pai on January 21, 2011 at 01:01 AM EST #

I'm guessing the javassist problem is similar to this one http://community.jboss.org/thread/161417?tstart=0

Posted by Jaikiran Pai on January 21, 2011 at 01:02 AM EST #

Thanks for the comments. I'll take another look at JavAssist, see what the precise error message is and take the issue to the JBoss forums. - Dave

Posted by Dave Johnson on January 21, 2011 at 05:42 PM EST #

For problem #2: Use <use-java-context>false</use-java-context> as explained in http://community.jboss.org/wiki/configdatasources

Posted by kk on January 23, 2011 at 08:20 AM EST #

kk, thanks for the tip but it does not fix this problem.

When I change the name of the datasource in JBoss to "jdbc/rollerdb" and set the Use Java Context to true, I get this error message:

"javax.naming.NameNotFoundException: jdbc not bound Deployment "jdbc/rollerdb" is in error due to the following reason(s): ** NOT FOUND Depends on 'jdbc/rollerdb'

Posted by Dave Johnson on January 23, 2011 at 07:11 PM EST #

You should set use-java-context to false. :) Use-java-context = true is exactly what adds the "java:" prefix to the jndi name.

Posted by kk on January 30, 2011 at 03:57 PM EST #

I'm sorry, I misspoke. I changed the setting from true (the default) to false and I still got a JNDI name not found, "jdbc not found"

Posted by Dave Johnson on January 30, 2011 at 11:15 PM EST #

I checked out trunk but I cant get it to work. I am using tomcat(6). When I make mvn install in root-project I get "There are test failures" I have tried both maven 2 and 3 - I get the same error. I used -Dmaven.test.skip=true to get build successfull. But when I do "mvn -Dtomcat=true install" the war file is wrongly created. (in war-assembly) I have searched for documentation everywhere about this - but cant fint it. Can anyone please help me!?

Posted by Susanne on February 07, 2011 at 08:25 AM EST #

Hi Suzanne,

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, Dave

Posted by Dave Johnson on February 08, 2011 at 08:59 AM EST #

Hi Dave,

I am trying to deploy Roller 5 on JBoss 6 and I am getting the classcast exceptions you are talking about. Unfortunately there seems to be no specific roller war-file for JBoss.
Do you know where I can find that specific JBoss roller war-file.
The datasource connection is working fine.

Thanks, Peter

Posted by Peter on August 11, 2011 at 07:28 PM EDT #


We didn't get enough feedback about Roller 5.0 on JBoss 6, so we did not include JBoss 6 in the official release.

Despite that, you can get the Roller 5 for JBoss files here:



Posted by Dave Johnson on August 21, 2011 at 08:45 PM EDT #

What happened to the install guide you wrote? I can't seem to get roller running on JBoss 6.0.0 or 6.1.0.

Posted by Brian Lavender on August 27, 2012 at 01:43 AM EDT #

Post a Comment:
  • HTML Syntax: NOT allowed

« 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

Related entries

Below are the most recent entries in the category Roller, some may be related to this entry.