JBoss Installation

Version 18.1 by Vincent Massol on 2012/06/29

JBoss AS 7.x

JBoss AS 4.0.x

  • Download and install JBoss Application Server . It's usually as simple as unzipping it in a directory. Let's call this directory $JBOSS_HOME.
  • (optional) By default JBoss runs on port 8080. If you want to modify the port on which JBoss is running, edit $JBOSS_HOME/server/<mode>/deploy/jbossweb-tomcat55.sar/server.xml. Search for 8080 and replace with the port value you wish to use. Similarly change the port in $JBOSS_HOME/server/<mode>/deploy/http-invoker.sar/META-INF/jboss-service.xml to the value you like.
  • Copy and expand the XWiki WAR into a directory named xwiki.war/ (note that unlike most servlet containers JBoss wants the directory name to end with .war) in $JBOSS_HOME/server/<server configuration>/deploy where server configuration is the JBoss configuration you're using.
  • Edit $JBOSS_HOME/server/<mode>/deploy/jbossweb-tomcat55.sar/server.xml to set UTF-8 encoding:
    <Connector port="8080" ... URIEncoding="UTF-8"/>
    <Connector port="8009" ... URIEncoding="UTF-8"/>

Classloading Isolation

The default JBoss behavior is that classes inside of the WEB-INF/classes and WEB-INF/lib directories of the WAR file are incorporated into the default shared class loader repository. This allows classes and resources to be shared between web applications. However this means that JARs provided by XWiki in WEB-INF/lib will get mixed with JARs provided by JBoss and if both application provide the same JAR but in a different version, class incompatibilities will occur. 

To solve this, please read up on JBoss ClassLoading Configuration in order to configure JBoss to not use the unified class loader (set UseJBossWebLoader to false in META-INF/jboss-service.xml).

Alternatively you may try to remove the clashing JARs from XWiki's WEB-INF/lib hoping that the version provided by JBoss is compatible with XWiki's needs.

Log4j Error

Warning

It was reported that with XWiki 1.6 and JBoss 4.0.4, these settings change would generate an error with hibernate. Everything seems to work fine without these settings including classloading of log4j

  • Edit $JBOSS_HOME/server/<server configuration>/jbossweb-tomcat55.sar/META-INF/jboss-service.xml file and replace:
<attribute name="Java2ClassLoadingCompliance">false</attribute>
<attribute name="UseJBossWebLoader">false</attribute>

with:

<attribute name="Java2ClassLoadingCompliance">true</attribute>
<attribute name="UseJBossWebLoader">true</attribute>

This is to avoid class loading issues for Log4J library. Refer http://lists.xwiki.org/pipermail/users/2007-September/008503.html for more information.

Using a JBoss DataSource

  • Uncomment the resource-ref section in XWiki's web.xml file.
  • Modify XWiki's WEB-INF/hibernate.cfg.xml file to tell Hibernate to use a DataSource rather than a direct JDBC connection
  • Copy the jboss-web.xml file to XWiki's WEB-INF/ directory

Issues related to JBoss

Get Connected