NoSuchFieldError Deploying JIRA on JBoss
Symptoms
When trying to deploy JIRA on JBoss 4.x, the following error appears in the log:
2009-03-25 11:13:16,046 FATAL [com.atlassian.jira.upgrade.ConsistencyLauncher]
An Error occurred during ConsistencyLauncher servlet context initialisation - ANY_HOST_CONFIGURATION.
java.lang.NoSuchFieldError: ANY_HOST_CONFIGURATION
at org.apache.commons.httpclient.params.HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(HttpConnectionManagerParams.java:85)
Cause
This is caused by a classloading issue. JBoss and JIRA both ship with a version of Jakarta Commons HTTP Client and the JBoss classloader is using a conflicting version.
Resolution
Option 1
Replace $JBOSS_HOME/servers/default/lib/commons-httpclient.jar
with the version provided by JIRA in webapps/WEB-INF/jira/commons-httpclient-x.x.x.jar
where x.x.x is the version e.g. commons-httpclient-3.0.1.jar
. If you do this, make sure to backup the version provided by JBoss in case something goes wrong.
{panel:bgColor=#EAECFF|title=Option 2}
The other option is to [configure the JBoss classloader|http://www.jboss.org/community/docs/DOC-9288] in {{jboss-web.xml}} to use the correct version:
{code:xml}<jboss-web>
<class-loading>
<loader-repository>
org.apache.commons.httpclient:loader=commons-httpclient-3.0.1.jar
</loader-repository>
</class-loading>
</jboss-web>