Installing JIRA Importers Plugin on versions of Tomcat prior to 6 fails
Symptoms
- Installing, Enabling or Upgrading the JIRA Importers Plugin (or JIM)
- Using a version of Tomcat prior to 6
- The following stack trace will appear in the logs:
The following appears in the atlassian-jira.log
:
2013-01-14 08:51:08,390 TP-Processor1 INFO localuser 531x1877x1 iyjrff 192.168.185.95 /rest/plugins/1.0/com.atlassian.jira.plugins.jira-importers-plugin-key [atlassian.plugin.util.WaitUntil] Plugins that have yet to be enabled: [com.atlassian.jira.plugins.jira-importers-plugin], 56 seconds remaining
2013-01-14 08:51:08,405 FelixDispatchQueue ERROR [osgi.container.felix.FelixOsgiContainerManager] Framework error in bundle com.atlassian.templaterenderer.atlassian-template-renderer-velocity16-plugin
org.osgi.framework.ServiceException: Service factory exception: org.apache.velocity.exception.VelocityException: Failed to initialize an instance of org.apache.velocity.runtime.log.CommonsLogLogChute with the current runtime configuration.
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:311)
at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:221)
at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:295)
...
Caused by: java.lang.RuntimeException: org.apache.velocity.exception.VelocityException: Failed to initialize an instance of org.apache.velocity.runtime.log.CommonsLogLogChute with the current runtime configuration.
at com.atlassian.templaterenderer.velocity.one.six.internal.VelocityTemplateRendererImpl.<init>(VelocityTemplateRendererImpl.java:77)
at com.atlassian.templaterenderer.velocity.one.six.internal.VelocityTemplateRendererServiceFactory.getService(VelocityTemplateRendererServiceFactory.java:33)
at org.springframework.osgi.service.exporter.support.internal.support.PublishingServiceFactory.getService(PublishingServiceFactory.java:105)
...
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
...
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 59 more
Caused by: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385)
Cause
This happens because the commons-logging library comes bundled with the JIM, and as this already exists in the Tomcat directory, it causes JIRA to read a duplicate, and consequently fails to initialize the plugin. It appears this is related to the problem described when installing the UPM, as mentioned in the Installing UPM 2.7.2 or later on versions of Tomcat prior to 6 fails knowledge base article.
Workaround
There are two workarounds for this problem. You can either replace the Tomcat's common-logging-x.x.x.jar file with commons-logging-1.1.1.jar or you can remove the commons-logging jar from the JIRA Importers Plugin. By updating Tomcat's common-logging, you'll also be able to install the latest UPM releases without facing this issue. If you'd rather hack the JIM jar, however, please follow the steps below:
- Download the latest version on the JIRA Importers Plugin
- Extract the contents of the jar
- Remove the
commons-logging-x.x.x.jar
file inside theMETA-INF/lib
folder - Zip all the files again
- Rename it from
jira-importers-plugin-x.x.x.zip
tojira-importers-plugin-x.x.x.jar
- Navigate to
Administration » Plugins
, select Upload Plugin and install the modified JIM jar
Resolution
To resolve this issue you need to upgrade Tomcat to version 6 or later. You can run through the following steps to get the JIRA importers plugin installed/upgraded:
- Shutdown JIRA.
Remove JIM from your
$JIRA_HOME/plugins/installed-plugins
directory.- Migrate Tomcat to version 6
- Startup JIRA again, the older, bundled version of the JIM should now load.
- Upgrade the JIM from the UPM as normal.