Atlassian Confluence 3.1.2 on Sun Glassfish V2
von Mario Rasser
Abstract
Confluence is a Enterprise Wiki from Atlassian, which is just awesome. It is supporting tons of free and commercial Plugins and Themes. It is perfect for documentation, document management and working in Teams.
We are using it since the middle of the last year starting with Version 3.0.2 running on Sun Oracle Glassfish V2 Application Server. The first Upgrade try to Confluence 3.1.1 failed caused by compatibility issues of Apache Xerces. Denny a colleague of mine figured out a way to solve that issue.
The Confluence setup it self is well described on the Atlassian Homepage, but as Atlassian is not officially supporting Sun Oracle Glassfish Application Server, this post will describe how to get Confluence running on Glassfish V2.
Preparing of the Confluence WAR
Download the Confluence WAR (in our case Confluence 3.1.2 from 3th March 2010) from the Atlassian Homepage, to the Linux Box you want to deploy the file on:
Download EAR/WAR and extract
cd /usr/local/src
wget http://www.atlassian.com/software/confluence/downloads/binary/confluence-3.1.2.tar.gz
tar xfzv confluence-3.1.2.tar.gz
Confluence needed changes
vi confluence-3.1.2/confluence/WEB-INF/classes/confluence-init.properties
and set confluence.home=/local/confluence to you Confluence Data Directory.
Afterwards create the data directory mkdir -p /local/confluence, you may need to change the owner and/or rights to the USER Glassifish is running as.
Finally build the new WAR, that will be deployed on the Glassfish Application Server:
/usr/local/src/confluence-3.1.2#sh build.sh
Changes in Glassfish
There are compatibility issues between the Apache Xerces library shipped with Glassfish and the one shipped with Confluence > 3.1.
To prevent the conflicts in the JAVA Classpath we need to rename the GLASSFISH_HOME/lib/webservices-rt.jar to GLASSFISH_HOME/lib/webservices-rt-v2u1-b09d.jar, than edit GLASSFISH_HOME/domains/*/config/domain.xml and replace the library name by the modified library file name and restart the domain and the node agents.
YEAH YEAH, all previously existing exception caused by the different Apache Xerces Libraries are gone
Deployment in a rush
Skip the steps that are not need on your installation, e.g. if you already have a running node agent or similar
As said in the intro, the Setup and Installation is well described by Atlassian. So these steps will describe the deployment on a clustered Glassfish in a rush:
- Create DB and DB User
- Get the JDBC Connector for MySQL, if not already installed
- Copy the
mysql-connector-java-5.0.6-bin.jartoGLASSFISH_HOME/lib - Create MySQL Connection Pool (test the connectivity)
- Create a node-agent
- Create a cluster called confluence
- Create cluster instance for your node
- Create a DataSource
jdbc/ConfluenceDSusing the already created ConnectionPool, assign it to the cluster confluence and enable it - Deploy the created WAR to the Application Server
- Start the Cluster instance on the node you want to run it on
- Proceed the need steps via the installation process
Update 1
We have successfully deployed Atlassian Confluence 3.3 on Glassfish V2. So this HowTo can be adopted to Confluence 3.3 Version too.
Update 2
Today we deployed the new Atlassian Confluence 3.4 Version on Glassfish V2. So this HowTo can be used for the Confluence 3.4 installation too.

I don’t quite understand how the chang in glassfish you described could resolve the issue (unless you make a typo somewhere).
The problem is that there two different xerces versions on the classpath and the one from glassfish takes precedence over the one bundled with Confluence. But since the one that comes with confluence is newer and confluence utilizes the new api & features, it fails to run with the xerces that is exposed from glassfish.
One of the solutions is to copy the xalan jar from confluence to glassfish/domain//lib/
uhh.. wordpress mangled the path, it should be: glassfish/domain/_yourdomain_/lib/
Hey,
in my case i moved the
/usr/share/glassfishv2/lib/webservices-rt.jarto/usr/share/glassfishv2/lib/webservices-rt-v2u1-b09d.jar. Furthermore I changed/var/lib/glassfishv2/domains/domain1/config/domain.xmlto match the above mentioned file. So Glassfish uses the above JAR, as Glassfish it self needs that lib and Confluence uses it shipped version ofwebservices-rt.jar. The Glassfish jar is still in the Java CLASSPATH, but does not take precedence over the Confluence shipped one. BTW the lib path is the same where themysql-connector-java-5.1.10-bin.jaris installed in.I have not tried to copy the the Confluence lib to the Glassfish lib path, as i assume it will brake Glassfish itself.
The given Exception without changing the above described stuff was in
atlassian-confluence.log:Thank you, thank you, thank you! Now I can finally upgrade and close my open ticket:
https://support.atlassian.com/browse/CSP-44715
Glad i was able to help. Official support for
SunOracle Glassfish would be even better.