I was trying to follow the example given at https://developer.atlassian.com/display/DOCS/Plugin+Tutorial+-+Writing+event+listeners+with+the+atlassian-event+library on writing event listeners using the atlassian-event library, to update an existing working JIRA event listener I had written. The existing listener uses very deprecated classes and methods, and does not self-install via the UPM. So it seemed like a great idea to update it to use this library and make it a plugin.
However, I had trouble getting it to work. So much so that I finally just downloaded the entire example tutorial listener from Bitbucket and compiled it. The tutorial does not work with JIRA 4.4 either! In fact, it appears the constructor never even gets called. It does work perfectly when i compile it for JIRA 4.3.
I have not been able to find any documentation on what changed between 4.3 and 4.4 that is causing this failure. Can someone point me at the appropriate documentation, or can the tutorial be updated to work with 4.4, please?
Community moderators have prevented the ability to post new answers.
when I am going to register this in Listener getting error:
Class [com.example.tutorial.plugins.IssueCreatedResolvedListener] is not of type JiraListener.
I added some print outs (see below), but it does not work. I see nothing on the catalina.out. it looks like the plugin is not loaded the JIRA and @EventListener does not work.
eventPublisher.register( this);
System.out.println("REGISTERED");
}
/**
* Called when the plugin is being disabled or removed.
*
@throws
Exception
*/
System.out.println("DESTROYED");
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is my working plugin.xml component delcaration for a 5.x listener:
<component-import key="eventPublisher" interface="com.atlassian.event.api.EventPublisher"/>
<component key="eventListener" name="JEMH Issue Event Listener" class="com.javahollic.jira.emh.service.listener.JEMHIssueEventListener"> </component>
Then, my listener class is declared as:
public class JEMHIssueEventListener implements InitializingBean, DisposableBean
Within the listener (constructor wired) I have:
@Override
public void afterPropertiesSet() throws Exception
{
fEventPublisher.register(this);
}
And:
@Override
public void destroy() throws Exception
{
fEventPublisher.unregister(this);
}
And of course:
@EventListener
public void onIssueEvent(IssueEvent issueEvent)
{
So. with the stubs above, you ought to get a plugin deployed and a the listener invoked. If you are not able to do this, you should check the status of the deployment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thank you Andy,
i have same code. : https://answers.atlassian.com/questions/138943/my-eventlistener-not-called
but i get nothing see on the catalina.out or on logs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
increase your logging level via JIRA Admin > Logging and Profiling. When you deploy, there is traffic, look for stack traces...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Andy I have the same code and I've turned on all logging capabilities on JIRA but I'm still not seeing any output from my event lsitener. Do you have any ideas as to why this is happening or how I can resolve it? Any help would be greatly appreciated!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have same problem. do somebody have jiraListener example for jira 5.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
is your plugin will generated event if I create an Issue using Import?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have verified that the tutorial is working correctly on JIRA 4.4.1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We are running JIRA 5 now and I've refactored my plugin to use that. I'm going to guess that the problem may have been a particular version of the SDK, as I've encountered problems of that nature subsequently.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
is your plugin will generated event if I create an Issue using Import?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I dont have time to do the tutorial but Ive looked at it and seems to match what I have. Listeners do work in 4.4, I use it for bi-directional between JIRA and Brightidea (plugin page), in a nutshell.
There isnt a 'Listener' module type so you cant use 'atlas-create-jira-plugin-module'. You have to create a component entry in your atlassian-plugin.xml, like:
<component key="eventListener" class="com.javahollic.SomeIssueListener"/>
The related code is pretty much whats presented on https://developer.atlassian.com/display/DOCS/Plugin+Tutorial+-+Writing+event+listeners+with+the+atlassian-event+library#PluginTutorial-Writingeventlistenerswiththeatlassian-eventlibrary-lifecycle.
If you've deployed your plugin, did it deploy, are there logs indicating a problem? Have you tried a remote socket attach debug against JIRA?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, the plugin deployed. However, a log message I try to issue in the constructor never appears -- as if the constructor were never called.
I've been able to recompile my custom-written listener developed for 4.3 against 4.4 using the updated SDK atlas tools, so I haven't spent much more time on doing it the "right way" as a plugin yet.
But as I mentioned in my original posting, I merely took the entire example code for the tutorial from the Atlassian repository and compiled it according to the tutorial instructions. Except for subsequently adding log calls in an effort to debug it, I otherwise did not alter the code or the XML. Hence, if the code or XML were wrong, the example itself is wrong, since that is what I was using.
As to the specifics of the component key, etc., here is the atlassian-plugin.xml in its entirety:
<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}" /> </plugin-info> <component-import key="eventPublisher" interface="com.atlassian.event.api.EventPublisher"> <description>atlassian-event EventPublisher imported from system bundle.</description> </component-import> <component key="eventListener" class="com.example.tutorial.plugins.IssueCreatedResolvedListener"> <description>Class that processes the incoming JIRA issue events.</description> </component> </atlassian-plugin>
I have not tried a remote socket attach debug against JIRA -- yet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.