How to configure the Java Agent with Atlassian JIRA

Document ID : KB000097826
Last Modified Date : 06/08/2018
Show Technical Document Details
Issue:
After enabling the Java Agent in Atlassian JIRA, we are unable to startup the application, seeing this errors in the catalina.out log:

    ___ Starting the JIRA Plugin System _________________
2017-09-18 16:49:48,225 ThreadPoolAsyncTaskExecutor::Thread 3 ERROR      [c.a.p.osgi.factory.OsgiPlugin] Unable to start the plugin container for plugin 
..
Caused by: java.lang.ClassNotFoundException: com.atlassian.jira.issue.IssueUtilsBean
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
    at org.apache.felix.framework.ExtensionManager$ExtensionManagerWiring.getClassByDelegation(ExtensionManager.java:873)
    at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1553)
..

OR

15-May-2018 14:22:56.709 SEVERE [main] org.apache.catalina.startup.Catalina.load Catalina.start
 org.apache.catalina.LifecycleException: Failed to initialize component [StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
at org.apache.catalina.startup.Catalina.load(Catalina.java:580)
at org.apache.catalina.startup.Catalina.load(Catalina.java:603)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)
Caused by: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:200)
at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:152)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:232)
at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:120)
at org.apache.catalina.core.JreMemoryLeakPreventionListener.lifecycleEvent(JreMemoryLeakPreventionListener.java:417)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:388)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:101)
... 8 more
Caused by: java.lang.ClassNotFoundException: org/apache/xerces/jaxp/DocumentBuilderFactoryImpl
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:124)
at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:188)
... 16 more
Environment:
Tomcat Apache 8.0.38
Jvm 1.8
Jira 7.2.10
Resolution:
1- Stop JIRA application
2- Open the startup script, add the below additional jvm arguments:

-javaagent:<AGENT_HOME>/Agent.jar 
-Dcom.wily.introscope.agentProfile=<AGENT_HOME>/core/config/IntroscopeAgent.profile 
-Datlassian.org.osgi.framework.bootdelegation=com.wily,com.wily.*,sun.*,org.w3c.*,org.xml.sax.*,org.apache.xerces.*,com.sun.org.apache.xalan.*,org.apache.xml,org.apache.xml.*,javax.xml,javax.xml.*,com.sun,com.sun.*org.apache.xalan,org.apache.xalan.* 
-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl 
-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl

Here is an example from JIRA setenv.sh startup script (unix) :

CATALINA_OPTS="-javaagent:/u01/app/atlassian/jira/software/wily/Agent.jar -Dcom.wily.introscope.agentProfile=/u01/app/atlassian/jira/software/wily/core/config/IntroscopeAgent.profile -Datlassian.org.osgi.framework.bootdelegation=com.wily,com.wily.*,sun.*,org.w3c.*,org.xml.sax.*,org.apache.xerces.*,com.sun.org.apache.xalan.*,org.apache.xml,org.apache.xml.*,javax.xml,javax.xml.*,com.sun,com.sun.*org.apache.xalan,org.apache.xalan.* -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl"

3. Start JIRA

 
Additional Information:
If the problem persists, enable verbose classloading by adding the jvm argument "-verbose:class", restart the JVM
Open a support case and include the catalina.out, startup script(setenv) and agent logs, if any