Kafka Spring Listener in Jira Plugin

Hi everyone,

(I hope this is not a duplicate post, the first one kind of disappeared)
I am trying to implement a Kafka Listener in a Jira Server Plugin with the help of the Spring Kafka Implementation. Unsurprisinly I am facing dependency issues. I tried several approaches including using an existing Jira Plugin, building one from scratch and using a plugin tutorial as basis. In any case I am not able to activate the plugin once I include the kafka dependency. (I did not implement anything with it, just including it.) Before including the dependency everything works fine.

The plugin tutorial I used is
https://developer.atlassian.com/server/framework/atlassian-sdk/creating-an-admin-configuration-form/

I modified the pom.xml by adding the dependency

<dependency>
  <groupId>org.springframework.kafka</groupId>
  <artifactId>spring-kafka</artifactId>
  <version>2.7.7</version>
  <exclusions>
    <exclusion>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
    </exclusion>
  </exclusions>
</dependency>

as well as adding kafka to the import-package configuration

<Import-Package>
  org.springframework.osgi.*;resolution:="optional",
  org.eclipse.gemini.blueprint.*;resolution:="optional",
  org.springframework.kafka.*,
  *
</Import-Package>

I receive the following error:

2021-10-12 15:59:47,551+0200 UpmAsynchronousTaskManager:thread-3 WARN admin 883x218x1 jn49hc 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ [c.a.plugin.impl.AbstractPlugin] Unable to enable plugin 'com.atlassian.plugins.tutorial.xproduct-admin-ui-plugin'
2021-10-12 15:59:47,551+0200 UpmAsynchronousTaskManager:thread-3 WARN admin 883x218x1 jn49hc 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ [c.a.plugin.impl.AbstractPlugin] Because of this exception
com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: com.atlassian.plugins.tutorial.xproduct-admin-ui-plugin
	at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:424)
	at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:258)
	at com.atlassian.plugin.manager.PluginEnabler.actualEnable(PluginEnabler.java:120)
	at com.atlassian.plugin.manager.PluginEnabler.enable(PluginEnabler.java:97)
	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$enableDependentPlugins$22(DefaultPluginManager.java:1235)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.enableDependentPlugins(DefaultPluginManager.java:1219)
	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$addPlugins$20(DefaultPluginManager.java:1204)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:1104)
	at com.atlassian.jira.plugin.JiraPluginManager.addPlugins(JiraPluginManager.java:157)
	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$scanForNewPlugins$12(DefaultPluginManager.java:911)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.scanForNewPlugins(DefaultPluginManager.java:867)
	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$installPlugins$11(DefaultPluginManager.java:827)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.installPlugins(DefaultPluginManager.java:813)
	at com.atlassian.jira.plugin.JiraPluginManager.installPlugins(JiraPluginManager.java:167)
	at jdk.internal.reflect.GeneratedMethodAccessor860.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
	at com.sun.proxy.$Proxy306.installPlugins(Unknown Source)
	at jdk.internal.reflect.GeneratedMethodAccessor860.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
	at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
	at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
	at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
	at com.sun.proxy.$Proxy1702.installPlugins(Unknown Source)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler$1.doInTransaction(AbstractPluginInstallHandler.java:133)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler$1.doInTransaction(AbstractPluginInstallHandler.java:128)
	at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21)
	at com.atlassian.jira.DefaultHostContextAccessor.doInTransaction(DefaultHostContextAccessor.java:50)
	at jdk.internal.reflect.GeneratedMethodAccessor247.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
	at com.sun.proxy.$Proxy230.doInTransaction(Unknown Source)
	at jdk.internal.reflect.GeneratedMethodAccessor247.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:130)
	at com.sun.proxy.$Proxy230.doInTransaction(Unknown Source)
	at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:18)
	at jdk.internal.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
	at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
	at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
	at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
	at com.sun.proxy.$Proxy1749.execute(Unknown Source)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installArtifacts(AbstractPluginInstallHandler.java:127)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installArtifact(AbstractPluginInstallHandler.java:113)
	at com.atlassian.upm.core.install.JarPluginInstallHandler.installPluginInternal(JarPluginInstallHandler.java:52)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installPlugin(AbstractPluginInstallHandler.java:54)
	at com.atlassian.upm.core.install.DefaultPluginInstallationService.execute(DefaultPluginInstallationService.java:130)
	at com.atlassian.upm.core.install.DefaultPluginInstallationService.install(DefaultPluginInstallationService.java:98)
	at com.atlassian.upm.install.UpmPluginInstallationService.install(UpmPluginInstallationService.java:114)
	at com.atlassian.upm.core.rest.resources.install.InstallTask.installFromFile(InstallTask.java:153)
	at com.atlassian.upm.core.rest.resources.install.InstallFromFileTask.executeTask(InstallFromFileTask.java:36)
	at com.atlassian.upm.core.rest.resources.install.InstallTask.run(InstallTask.java:78)
	at com.atlassian.upm.core.async.AsynchronousTaskManager.executeTask(AsynchronousTaskManager.java:121)
	at com.atlassian.upm.core.async.AsynchronousTaskManager$1.call(AsynchronousTaskManager.java:99)
	at com.atlassian.upm.core.async.AsynchronousTaskManager$1.call(AsynchronousTaskManager.java:96)
	at com.atlassian.sal.core.executor.ThreadLocalDelegateCallable.call(ThreadLocalDelegateCallable.java:38)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.osgi.framework.BundleException: Unable to resolve com.atlassian.plugins.tutorial.xproduct-admin-ui-plugin [267](R 267.0): missing requirement [com.atlassian.plugins.tutorial.xproduct-admin-ui-plugin [267](R 267.0)] osgi.wiring.package; (osgi.wiring.package=bsh) Unresolved requirements: [[com.atlassian.plugins.tutorial.xproduct-admin-ui-plugin [267](R 267.0)] osgi.wiring.package; (osgi.wiring.package=bsh)]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4149)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:2119)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
	at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:405)

Does anyone have experience with the topic? Or can tell my what I am doing wrong here? If you need more information let me know any help is appreciated.

Thank you in advance!

(Jira version is v8.19.1)

1 Like