Jira Plugin developing

Hi,

If "resolve issue" button clicked in jira, i have to trigger an event from that for that i developed a plugin and i wrote a listener class for handling that event .But when i trying to call that plugin, i am getting the following errors in jira's log file because of that the listener class was not called.

First error:

___ Plugin System Started _________________

2013-07-05 21:58:52,196 localhost-startStop-1 ERROR [atlassian.jira.event.DefaultListenerManager] Could not configure listener: TestResolveIssueEvent className:com.atlassian.tutorial.helloworld.IssueCreatedResolvedListener
com.atlassian.jira.event.ListenerException: Could not create listener for class: com.atlassian.tutorial.helloworld.IssueCreatedResolvedListener
at com.atlassian.jira.event.ListenerFactory.getListener(ListenerFactory.java:42)
at com.atlassian.jira.event.DefaultListenerManager$Listeners.loadListeners(DefaultListenerManager.java:162)
at com.atlassian.jira.event.DefaultListenerManager$Listeners.create(DefaultListenerManager.java:104)
at com.atlassian.jira.event.DefaultListenerManager$Listeners.create(DefaultListenerManager.java:99)
at com.atlassian.util.concurrent.ResettableLazyReference$InternalReference.create(ResettableLazyReference.java:140)
at com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:321)
at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:143)
at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112)
at com.atlassian.util.concurrent.ResettableLazyReference.get(ResettableLazyReference.java:87)
at com.atlassian.jira.event.DefaultListenerManager$Listeners.start(DefaultListenerManager.java:126)
at com.atlassian.jira.event.DefaultListenerManager.start(DefaultListenerManager.java:47)
at com.atlassian.jira.ComponentManager.runStartable(ComponentManager.java:288)
at com.atlassian.jira.ComponentManager.startJIRA(ComponentManager.java:235)
at com.atlassian.jira.ComponentManager.quickStart(ComponentManager.java:210)
at com.atlassian.jira.ComponentManager.start(ComponentManager.java:195)
at com.atlassian.jira.upgrade.PluginSystemLauncher.start(PluginSystemLauncher.java:23)
at com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:124)
at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:315)
at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:209)
at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:112)
at com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:30)
at com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:75)
at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:33)
at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:70)
at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:54)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1654)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalStateException: Bundle is uninstalled
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1574)
at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:887)
at com.atlassian.plugin.osgi.util.BundleClassLoaderAccessor$BundleClassLoader.findClass(BundleClassLoaderAccessor.java:69)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.atlassian.jira.plugin.DefaultComponentClassManager.constructEvenIfNotEnabled(DefaultComponentClassManager.java:133)
at com.atlassian.jira.plugin.DefaultComponentClassManager.newInstance(DefaultComponentClassManager.java:70)
at com.atlassian.jira.event.ListenerFactory.getListener(ListenerFactory.java:31)
... 38 more
2013-07-05 21:58:52,263 localhost-startStop-1 INFO [jira.config.database.SystemDatabaseConfigurationLoader] Reading database configuration from D:\Projects\atlastutorial\amps-standalone\target\jira\home\dbconfig.xml
2013-07-05 21:58:52,277 localhost-startStop-1 INFO [jira.instrumentation.external.DatabaseExternalGauges] Installing DBCP monitoring instruments: DatabaseExternalGauges.TomcatDbcpInstruments[instruments=[DBCP_MAX, DBCP_ACTIVE, DBCP_IDLE],objectName=Catalina:type=DataSource,path=/jira,host=localhost,class=javax.sql.DataSource,name="jdbc/JiraDS"]
2013-07-05 21:58:52,763 localhost-startStop-1 INFO [atlassian.jira.upgrade.ConsistencyCheckImpl] Checking JIRA consistency
2013-07-05 21:58:52,794 localhost-startStop-1 INFO [atlassian.jira.upgrade.ConsistencyCheckImpl] The Server ID for this JIRA instance is: [BP8Q-WXN6-SKX3-NB5M]
2013-07-05 21:58:53,636 localhost-startStop-1 INFO [atlassian.jira.startup.JiraStartupLogger]

second error:

ERROR admin 1324x1637x1 1h6p9lw fe80:0:0:0:3d2f:a8d5:972f:af75 /rest/plugins/1.0/ [plugin.osgi.factory.OsgiPlugin] Unable to start the plugin container for plugin com.atlassian.tutorial.helloworld
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/osgi]
Offending resource: URL [bundle://144.0:0/META-INF/spring/atlassian-plugins-components.xml]

at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:281)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1294)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)

So Please help me

Best regards,

Joe Paul

3 answers

1 accepted

Hey Joe,

You can check out my tutorial for writing a JIRA listener available here

https://bitbucket.org/bhushan154/jira-listener-tutorial/wiki/Home

You can also clone the source code from here

https://bitbucket.org/bhushan154/jira-listener-tutorial/src

The first place to look for when your plugin doesn't start up would be your log file in your plugin's target/jira/home/log folder.

Cheers

Bhushan Nagaraj's Visual Thumbprint

Thanks Bhushan,thanks a lot.I created a plugin using that i can call my listener class.

one question i have to ask you about listner class. If i am using a listener class, that class path i have to give in jira?is must?Because i saw a listener section in jira ,in that we can add our listener class path and name.When i am trying to add that class path the following error is showing in jira

Class [com.stygian.jira.plugins.listeners.ResolutionEventListener] is not of type JiraListener.

Can you tell me where exactly you saw that and what you are referring to?

Hi bhushan,

'Registering a listener class in jira', this i saw in the following link

https://confluence.atlassian.com/display/JIRA/Listeners

Oops,

Sorry had missed adding this and have updated my tutorial. The class should extend AbstractIssueEventListener and implement the method getDescription()

Check the tutorial which has been updated.

Cheers

Bhushan

Thanks bhushan=================

0 vote

Looks like there is an error parsing atlassian-plugin.xml file. Take another look and see if you have misconfigured any plugin module.

Hi jobin,

This is my atlassian-plugin.xml file

<atlassian-plugin key="com.atlassian.tutorial.helloworld" name="helloworld" plugins-version="2">
<plugin-info>
<description>This is the com.atlassian.tutorial:helloworld plugin for Atlassian JIRA.</description>
<version>1.0-SNAPSHOT</version>
<vendor name="Example Company" url="http://www.example.com/" />
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>

<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="helloworld"/>

<!-- add our web resources -->
<web-resource key="helloworld-resources" name="helloworld Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>

<resource type="download" name="helloworld.css" location="/css/helloworld.css"/>
<resource type="download" name="helloworld.js" location="/js/helloworld.js"/>
<resource type="download" name="images/" location="/images"/>

<context>helloworld</context>
</web-resource>

<!-- publish our component -->
<component key="myPluginComponent" class="com.atlassian.tutorial.helloworld.MyPluginComponentImpl" public="true">
<interface>com.atlassian.tutorial.helloworld.MyPluginComponent</interface>
</component>
<component-import key="eventPublisher" interface="com.atlassian.event.api.EventPublisher"/>
<component key="eventListener" class="com.atlassian.tutorial.helloworld.IssueCreatedResolvedListener">
<description>Class that processes the incoming JIRA issue events.</description>
</component>


<!-- import from the product container -->
<component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" />

</atlassian-plugin>

Any error is there in this.

-----------------------------------------

My task is i have to trigger an event from "resolve issue"(system event) button in jira. Is there any other method to do this?Or which will be the correct method to follow for doing this task?Pls help me? Beacuse i don't have that much knowledge about jira architecture.

Hi jobin,

Thanks for your responce.This is my atlassian-plugin.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<atlassian-plugin key="com.atlassian.tutorial.helloworld" name="helloworld" plugins-version="2">
<plugin-info>
<description>This is the com.atlassian.tutorial:helloworld plugin for Atlassian JIRA.</description>
<version>1.0-SNAPSHOT</version>
<vendor name="Example Company" url="http://www.example.com/" />
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>

<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="com.atlassian.tutorial.helloworld"/>

<!-- add our web resources -->
<web-resource key="helloworld-resources" name="helloworld Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>

<resource type="download" name="helloworld.css" location="/css/helloworld.css"/>
<resource type="download" name="helloworld.js" location="/js/helloworld.js"/>
<resource type="download" name="images/" location="/images"/>

<context>helloworld</context>
</web-resource>

<!-- publish our component -->
<component key="myPluginComponent" class="com.atlassian.tutorial.helloworld.MyPluginComponentImpl" public="true">
<interface>com.atlassian.tutorial.helloworld.MyPluginComponent</interface>
</component>
<component-import key="eventPublisher" interface="com.atlassian.event.api.EventPublisher"/>
<component key="eventListener" class="com.atlassian.tutorial.helloworld.IssueCreatedResolvedListener">
<description>Class that processes the incoming JIRA issue events.</description>
</component>


<!-- import from the product container -->
<component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" />

</atlassian-plugin>

Any error is there in this.

My task is i have to trigger an event from "resolve issue"(system event) button in jira. Is there any other method to do this?Or which will be the correct method to follow for doing this task?Pls help me? Beacuse i don't have that much knowledge about jira architecture.

Thanks Bhushan,thanks a lot.Now i can call my listener class.

one question i have to ask you about listner class. If i am using a listener class, that class path i have to give in jira?is must?Because i saw a listener section in jira ,in that we can add our listener class path and name.When i am trying to add that class path the following error is showing in jira

Class [com.stygian.jira.plugins.listeners.ResolutionEventListener] is not of type JiraListener.


Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Apr 10, 2018 in Marketplace Apps

Learn about how Stefan K. built one of the *first ever* Marketplace apps

In this post you will discover more about the evolution of K15t software, some big topics they're currently focusing on in the app space, and a rare (not not funny!) photo of founders Mike Cannon-Bro...

13,055 views 11 24
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you