Problems with adding listener

srinivasp
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2012

Hi,

I tried to add a listener to jira but getting the following exception..

Class [com.examples.jira.listeners.MoveIssueListener] is not of type JiraListener

Please advise

3 answers

1 accepted

0 votes
Answer accepted
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2012

Does your class implement IssueEventListener interface?

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2012

Or has the @EventListener annotation and is registered in the atlassian-plugin.xml if written in the new way?

srinivasp
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2012

In the documentation it was not given to implement IssueEventListener interface.

Registered @eventListener annotation in the atlassian-plugin.xml file

srinivasp
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2012

I tried the first way of developing a listener by extending AbstractIssueEventListener class and found working. Is it better to continue this way? Please suggest.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2012

Both works fine. In the new way, you need to register the EventPublisher as well. Anyways, I wouldn't bother now that you have got it working using the old way.

srinivasp
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2012

Hi Jobin, I am not getting the actual project object in the event method instead getting the modified project name. I want some details from the actual project object and so i am trying for this. I tried in various ways but not getting the required objects. Kindly suggest a way for doing this.

0 votes
Laszlo Kremer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2012
0 votes
Laszlo Kremer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2012

I get the Class [com.mycompany.jira.plugins.VersionListener] is not of type JiraListener. error too. I can't extend the AbstractissueEventListener interface, because it is a Version listener.

It compiles, is instalalble, but cannot add the listener.

Please suggest!

The code is:

package com.mycompany.jira.plugins;

import com.atlassian.event.api.EventListener;
import com.atlassian.event.api.EventPublisher;
import com.atlassian.jira.event.project.VersionCreateEvent;

import com.atlassian.jira.event.issue.IssueEvent;

public class VersionListener {

	public VersionListener(EventPublisher eventPublisher)
	{
		eventPublisher.register(this);
	}

	@EventListener
	public void onVersionCreated(VersionCreateEvent versionCreateEvent){
		System.err.println("Version Created");
	}
}

The atlassian-plugin.xml has the needed component and component-import parts:

<component key="eventListener" class="com.mycompany.jira.plugins.VersionListener">
		<description>Class that processes the Version changes</description>
	</component>
	
	<component-import key="eventPublisher" interface="com.atlassian.event.api.EventPublisher"/>


Laszlo Kremer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2012

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events