Enabling Bitbucket CSE fails on Bitbucket Data center

Hi there,

I am working on a Bitbucket CSE plugin which I am developing from the template provided in the documentation.
Everything works fine in local development, I am able to create package and upload it into the Bitbucket plugin although when it comes to enabling the plugin, I keep getting a fail there.

I can’t figure out what is wrong, I tried building the plugin from the source without any modification from my end and I am getting the same error.

We are running Bitbucket v7.6.3

Here are the server logs:

2021-05-24 05:33:16,940 ERROR [UpmAsynchronousTaskManager:thread-1] simon @1O8Z6RHx333x1318x0 1fq8kay 10.1.28.137,192.168.16.4 "POST /rest/plugins/1.0/ HTTP/1.0" c.a.p.o.f.OsgiPluginInstalledHelper Cannot determine required plugins, cannot resolve bundle 'com.atlassian.myapp.bitbucket-plugin-template'
2021-05-24 05:33:16,941 INFO  [UpmAsynchronousTaskManager:thread-1] simon @1O8Z6RHx333x1318x0 1fq8kay 10.1.28.137,192.168.16.4 "POST /rest/plugins/1.0/ HTTP/1.0" c.a.plugin.manager.PluginEnabler Resolving 1 plugins
2021-05-24 05:33:16,942 INFO  [UpmAsynchronousTaskManager:thread-1] simon @1O8Z6RHx333x1318x0 1fq8kay 10.1.28.137,192.168.16.4 "POST /rest/plugins/1.0/ HTTP/1.0" c.a.plugin.manager.PluginEnabler Enabling 1 plugins: [com.atlassian.myapp.bitbucket-plugin-template]
2021-05-24 05:33:16,943 ERROR [UpmAsynchronousTaskManager:thread-1] simon @1O8Z6RHx333x1318x0 1fq8kay 10.1.28.137,192.168.16.4 "POST /rest/plugins/1.0/ HTTP/1.0" c.a.plugin.osgi.factory.OsgiPlugin Detected an error (BundleException) enabling the plugin 'com.atlassian.myapp.bitbucket-plugin-template' : Unable to resolve com.atlassian.myapp.bitbucket-plugin-template [140](R 140.0): missing requirement [com.atlassian.myapp.bitbucket-plugin-template [140](R 140.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.3)) Unresolved requirements: [[com.atlassian.myapp.bitbucket-plugin-template [140](R 140.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.3))].  This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see https://developer.atlassian.com/x/mQAN
2021-05-24 05:33:16,944 WARN  [UpmAsynchronousTaskManager:thread-1] simon @1O8Z6RHx333x1318x0 1fq8kay 10.1.28.137,192.168.16.4 "POST /rest/plugins/1.0/ HTTP/1.0" c.a.plugin.impl.AbstractPlugin Unable to enable plugin 'com.atlassian.myapp.bitbucket-plugin-template'
2021-05-24 05:33:16,945 WARN  [UpmAsynchronousTaskManager:thread-1] simon @1O8Z6RHx333x1318x0 1fq8kay 10.1.28.137,192.168.16.4 "POST /rest/plugins/1.0/ HTTP/1.0" c.a.plugin.impl.AbstractPlugin Because of this exception
com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: com.atlassian.myapp.bitbucket-plugin-template
	at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:424)
	at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:252)
	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:1243)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.enableDependentPlugins(DefaultPluginManager.java:1227)
	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$addPlugins$20(DefaultPluginManager.java:1212)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:1112)
	at com.atlassian.stash.internal.plugin.StashPluginManager.addPlugins(StashPluginManager.java:79)
	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$scanForNewPlugins$12(DefaultPluginManager.java:917)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.scanForNewPlugins(DefaultPluginManager.java:872)
	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$installPlugins$11(DefaultPluginManager.java:832)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.installPlugins(DefaultPluginManager.java:818)
	at com.atlassian.stash.internal.plugin.ClusteredPluginController.installPlugins(ClusteredPluginController.java:77)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	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.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.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler$1.doInTransaction(AbstractPluginInstallHandler.java:139)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler$1.doInTransaction(AbstractPluginInstallHandler.java:134)
	at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21)
	at com.atlassian.stash.internal.sal.spi.HostContextAccessorImpl.doInTransaction(HostContextAccessorImpl.java:54)
	at jdk.internal.reflect.GeneratedMethodAccessor659.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:18)
	at jdk.internal.reflect.GeneratedMethodAccessor652.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
	at jdk.internal.reflect.GeneratedMethodAccessor652.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	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.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.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installArtifacts(AbstractPluginInstallHandler.java:133)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installArtifact(AbstractPluginInstallHandler.java:119)
	at com.atlassian.upm.core.install.JarPluginInstallHandler.installPluginInternal(JarPluginInstallHandler.java:52)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installPlugin(AbstractPluginInstallHandler.java:60)
	at com.atlassian.upm.core.install.DefaultPluginInstallationService.execute(DefaultPluginInstallationService.java:133)
	at com.atlassian.upm.core.install.DefaultPluginInstallationService.install(DefaultPluginInstallationService.java:101)
	at com.atlassian.upm.install.UpmPluginInstallationService.install(UpmPluginInstallationService.java:120)
	at com.atlassian.upm.core.rest.resources.install.InstallTask.installFromFile(InstallTask.java:156)
	at com.atlassian.upm.core.rest.resources.install.InstallFromFileTask.executeTask(InstallFromFileTask.java:37)
	at com.atlassian.upm.core.rest.resources.install.InstallTask.run(InstallTask.java:81)
	at com.atlassian.upm.core.async.AsynchronousTaskManager.executeTask(AsynchronousTaskManager.java:124)
	at com.atlassian.upm.core.async.AsynchronousTaskManager$1.call(AsynchronousTaskManager.java:102)
	at com.atlassian.upm.core.async.AsynchronousTaskManager$1.call(AsynchronousTaskManager.java:99)
	at com.atlassian.sal.core.executor.ThreadLocalDelegateCallable.call(ThreadLocalDelegateCallable.java:38)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.lang.Thread.run(Thread.java:834)
	... 40 frames trimmed
Caused by: org.osgi.framework.BundleException: Unable to resolve com.atlassian.myapp.bitbucket-plugin-template [140](R 140.0): missing requirement [com.atlassian.myapp.bitbucket-plugin-template [140](R 140.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.3)) Unresolved requirements: [[com.atlassian.myapp.bitbucket-plugin-template [140](R 140.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.3))]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4149)
	... 64 common frames omitted
2021-05-24 05:33:16,945 ERROR [UpmAsynchronousTaskManager:thread-1] simon @1O8Z6RHx333x1318x0 1fq8kay 10.1.28.137,192.168.16.4 "POST /rest/plugins/1.0/ HTTP/1.0" c.a.plugin.manager.PluginEnabler Unable to enable plugin com.atlassian.myapp.bitbucket-plugin-template
com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: com.atlassian.myapp.bitbucket-plugin-template
	at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:424)
	at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:252)
	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:1243)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.enableDependentPlugins(DefaultPluginManager.java:1227)
	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$addPlugins$20(DefaultPluginManager.java:1212)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:1112)
	at com.atlassian.stash.internal.plugin.StashPluginManager.addPlugins(StashPluginManager.java:79)
	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$scanForNewPlugins$12(DefaultPluginManager.java:917)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.scanForNewPlugins(DefaultPluginManager.java:872)
	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$installPlugins$11(DefaultPluginManager.java:832)
	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
	at com.atlassian.plugin.manager.DefaultPluginManager.installPlugins(DefaultPluginManager.java:818)
	at com.atlassian.stash.internal.plugin.ClusteredPluginController.installPlugins(ClusteredPluginController.java:77)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	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.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.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler$1.doInTransaction(AbstractPluginInstallHandler.java:139)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler$1.doInTransaction(AbstractPluginInstallHandler.java:134)
	at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21)
	at com.atlassian.stash.internal.sal.spi.HostContextAccessorImpl.doInTransaction(HostContextAccessorImpl.java:54)
	at jdk.internal.reflect.GeneratedMethodAccessor659.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:18)
	at jdk.internal.reflect.GeneratedMethodAccessor652.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
	at jdk.internal.reflect.GeneratedMethodAccessor652.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	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.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.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installArtifacts(AbstractPluginInstallHandler.java:133)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installArtifact(AbstractPluginInstallHandler.java:119)
	at com.atlassian.upm.core.install.JarPluginInstallHandler.installPluginInternal(JarPluginInstallHandler.java:52)
	at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installPlugin(AbstractPluginInstallHandler.java:60)
	at com.atlassian.upm.core.install.DefaultPluginInstallationService.execute(DefaultPluginInstallationService.java:133)
	at com.atlassian.upm.core.install.DefaultPluginInstallationService.install(DefaultPluginInstallationService.java:101)
	at com.atlassian.upm.install.UpmPluginInstallationService.install(UpmPluginInstallationService.java:120)
	at com.atlassian.upm.core.rest.resources.install.InstallTask.installFromFile(InstallTask.java:156)
	at com.atlassian.upm.core.rest.resources.install.InstallFromFileTask.executeTask(InstallFromFileTask.java:37)
	at com.atlassian.upm.core.rest.resources.install.InstallTask.run(InstallTask.java:81)
	at com.atlassian.upm.core.async.AsynchronousTaskManager.executeTask(AsynchronousTaskManager.java:124)
	at com.atlassian.upm.core.async.AsynchronousTaskManager$1.call(AsynchronousTaskManager.java:102)
	at com.atlassian.upm.core.async.AsynchronousTaskManager$1.call(AsynchronousTaskManager.java:99)
	at com.atlassian.sal.core.executor.ThreadLocalDelegateCallable.call(ThreadLocalDelegateCallable.java:38)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.lang.Thread.run(Thread.java:834)
	... 40 frames trimmed
Caused by: org.osgi.framework.BundleException: Unable to resolve com.atlassian.myapp.bitbucket-plugin-template [140](R 140.0): missing requirement [com.atlassian.myapp.bitbucket-plugin-template [140](R 140.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.3)) Unresolved requirements: [[com.atlassian.myapp.bitbucket-plugin-template [140](R 140.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.3))]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4149)
	... 64 common frames omitted
1 Like

Hi @simonbuisson04,

It looks like you are using the page-bootstrapper package, and you haven’t installed the required dependency in your Bitbucket instance.

Please take a look at the Troubleshooting section in the README.md file. You can either install the missing dependency or remove the usage of PageExtensioncalls.

Thanks,
Maciej Adamczak
Atlassian Developer

Hey @madamczak thank you for the answer.

Sorry I should have added that I had tried both solutions (adding the atlassian-clientside-page-bootstrapper plugin and removing its reference), but the error remained the same in both cases.

If you removed the page-bootstrapper, can you try checking if you removed this line from the <Import-Package> section in the pom.xml?

com.atlassian.plugin.clientsideextensions;version="${cse.version}",

Hi @madamczak,

Thank you for the help, it seems I did forget to remove this line in <Import-Package>. Just removed it and my plugin is now working fine.

Thanks again,
Cheers,

1 Like