Using Atmosphere in a Jira Plugin

Andreas Kirkerud November 24, 2015

Hi,

I have been trying to get Atmosphere to work inside a Jira Plugin, but with no luck so far.

Looking through the documentation at the Atmosphere wiki I haven't found any examples that apply and work in my case

I have read that some of you have managed to get it working in Jira. 

What was your setup/code like ?

 

I have tried using code from the chat sample

I have tried setting up AmosphereServlet defining it in atlassian-plugin.xml and with annotations in the javacode

<servlet name="AtmosphereServlet" key="atmosphereServlet" class="org.atmosphere.cpr.AtmosphereServlet">
    <description>AtmosphereServlet</description>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
    <url-pattern>/chat/*</url-pattern>
  </servlet>
package com.example.chat;
 
import org.atmosphere.config.service.ManagedService;
 

@Config
@ManagedService(path = "/chat", atmosphereConfig = MAX_INACTIVE + "=120000")
public class ResourceChat { 
 
 
...

}

 

 

This all results in an error when requesting HTTP GET /jira/plugins/servlet/chat/test

 

Unable to create new reference LazyLoadedServletReference{descriptor=com.exaple.chat:atmosphereServlet (AtmosphereServlet), servletConfig=org.apache.catalina.core.StandardWrapperFacade@4b61540c}
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.AbstractMethodError: com.atlassian.plugin.servlet.PluginServletContextWrapper.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration;

 

I have published the example project on github at https://github.com/ankakaak/jira-atmosphere-example

 

 

5 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Florian Bauer
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.
December 2, 2017

Interested in this too...  did you make any progress?

0 votes
Javier Portillo
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.
December 12, 2016

Hi there,

 

any complete example of this somwhere??

 

Thanks in advance

0 votes
Nikolay January 25, 2016

It seems problem is old JIRA's servlet's API. It call method com.atlassian.plugin.servlet.PluginServletContextWrapper.getServletRegistration but for servlet's api version 2.4 (provided with JIRA 6.x) there's no such method (check https://developer.atlassian.com/static/javadoc/plugins/2.4/reference/com/atlassian/plugin/servlet/PluginServletContextWrapper.html), but it appeared in Servlet 3.0 API (check https://docs.atlassian.com/atlassian-plugins-servlet/3.1.0-m5/atlassian-plugins-servlet/apidocs/com/atlassian/plugin/servlet/PluginServletContextWrapper.html) so, it seems it should work with JIRA 7 because of servlet's API was updated to version 3.0.1

 

UPD: 

Tried with JIRA 7, I got error 500:

Servlet.service() for servlet [servlet-module-container-servlet] in context with path [] threw exception
org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler found. Make sure you define it inside WEB-INF/atmosphere.xml or annotate using @___Service
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:147)

 

It seems it needs web.xml or atmosphere.xml config at WEB-INF, Atlassian-plugin.xml is insufficiently for service registration

0 votes
Andreas Kirkerud November 25, 2015

Good point Ferenc. I changed the atlassian-plugin.xml to:

<servlet name="AtmosphereServlet" key="atmosphereServlet" class="org.atmosphere.cpr.AtmosphereServlet">
  <url-pattern>/chat*</url-pattern>
</servlet>

 

Unfortunately the error message remains the same :-/

 

I have now published the example project on github at https://github.com/ankakaak/jira-atmosphere-example

0 votes
Midori
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.
November 25, 2015

Andreas, I think your server definition is not correct. It resembles to the what you'd write to web.xml, not to atlassian-plugin.xml.

For example <load-on-startup> and <async-supported> are not supported by the servlet pluin module type!

Double check the XML!

See: https://developer.atlassian.com/jiradev/jira-platform/building-jira-add-ons/jira-plugins2-overview/jira-plugin-module-types/servlet-plugin-module

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events