Why am I getting "Unresolved constraint in bundle" exceptions after I migrated development environment to support JIRA7

Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 19, 2015

Hi there,

I am in the process of migrating my JIRA add-on to JIRA 7.x

However I am facing weird issues, one of them is  as below:

[INFO] [talledLocalContainer] Caused by: org.osgi.framework.BundleException:
Unresolved constraint in bundle com.mycompany.helloworld [192]: 
Unable to resolve 192.0: missing requirement [192.0] 
osgi.wiring.package;
(osgi.wiring.package=com.atlassian.plugin.spring.scanner.annotation.export)

Any comments?

Thanks

6 answers

1 accepted

25 votes
Answer accepted
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 24, 2015

I added following Import-Package lines to pom.xml. Saved my life

<Import-Package>
	javax.ws.rs*;version="[1,2)",	
	javax.servlet*;version="2.5",
	javax.xml.bind*;version="[2.1,3)",
	*;version="0";resolution:=optional
</Import-Package>
Alok Singh November 30, 2015

I am also getting this error Getting Unresolved constraint in bundle Unable to resolve 178.0: missing requirement [178.0] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.activeobjects.external)(version>=0.23.0)(!(version>=1.0.0))) while compiling the plugin on JIRA-7 I tried the above solution but it is generating IDE error.

nelswadycki January 19, 2016

@Tuncay Senturk [Snapbytes] - How did you figure out which packages to add to the Import-Package definition?

com.atlassian.plugin.spring.scanner.annotation.export seems very unrelated to the packages that you ended up adding.

Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 19, 2016

It has been while and I do not remember all steps. I'm not sure but the last line (including star) might do the trick.

Claudiu Milea January 29, 2016

importing the packages has worked for me as well

although the web item does not show so i need to investigate further

thanks

Like Dmitry_Orlov likes this
Ravi Singh February 26, 2016

any working tutorial for JIRA gadget plugin with rest api with sdk 6.2.2 and jdk 8?...thanks

Volodymyr Krupach
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.
April 20, 2016

Thank you!

I had  *;resolution:=optional without  *;version="0" and was getting

 

Unable to resolve 229.0: missing requirement [229.0] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.activeobjects.external)(version>=1.1.0)(!(version>=2.0.0)))

when reloading the addon through fastdev. Adding *;version="0" resolved the problem:

<Import-Package>
// my imports...
*;version="0";resolution:=optional
</Import-Package>


Like # people like this
Ma Hao August 3, 2016

Works for me, thanks.

What I met was :

missing requirement [183.0] osgi.wiring.package; (osgi.wiring.package=com.atlassian.plugin.spring.scanner.annotation.component

Like Dmitry_Orlov likes this
Sameer V October 23, 2017

Awesome!

Adding 

;version="0";resolution:=optional

 after the * fixed it for me too! 

Thanks!

Jamie Dworak March 9, 2018

Thanks, that worked.

Saurabh Gupta April 4, 2018

Does anyone understand what kind of change are we making here? If yes, please share.

Arın Mirza October 18, 2018

Unless you plan to list every single package your plugin needs, be sure to add the *;resolution:=optional value to your list of packages, when including bundle instructions in your plugin atlassian-plugin.xml XML.

The *;resolution:=optional value instructs the plugin system to continue to scan your classes for packages, but to resolve all packages optionally. This means if you bundle a library that has code that depends on other libraries you do not need, the resolution will not fail.

If, however, you are sure your code only refers to packages you need, you can omit the ;resolution:=optional string. The advantage here is that you will be notified on installation if required dependencies are missing.

Source: https://developer.atlassian.com/server/framework/atlassian-sdk/marking-packages-as-optional-imports/

Like # people like this
4 votes
Koen Martens December 18, 2015

Got this when following the JIRA plugin tutorial (https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/put-the-final-polish-on-the-project-in-eclipse). Nice introduction to JIRA plugin development ......

 

edit

Note to self or others who run into this: delete the target directory under your helloWorld plugin project, and it works fine again (just takes a long time to repopulate target).

Martin Simoneau January 19, 2016

Delete the target directory saved my day.

Thanks Koen !

Scott Wilson February 19, 2016

THis may work for helloworld, and initially for the MyPluginServlet part of the tutorial, but it fails when you try to run the servlet.  I would be ashamed of my work if I was tasked with writing this plugin documentation!!!!!

 

3 votes
dralexk October 14, 2016

I have found a solution in https://bitbucket.org/atlassian/atlassian-spring-scanner.

In the dependencies section, make sure that the scope of the following is provided.

<dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>provided</scope>
        </dependency>
Alok December 10, 2016

Thanks, this saved me big time. I forgot the concept of maven dependency mechanism and I spent almost like 1 hour to fix this problem and suddenly I saw this.

2 votes
Nabil Sayegh
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.
July 19, 2016

Try

atlas-mvn clean

wink

Roman Samorodov
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.
July 25, 2016

Doesn't help me. This command just delete "target" folder.

Nabil Sayegh
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.
August 16, 2016

It helps every single time here, especially when upgrading sdk/amps or dependencies.

Claus Gerull August 24, 2016

Helped me too with an "Unable to resolve 161.0: missing requirement ..."  OSGI error.

 

Nabil Sayegh January 25, 2017

I just realized when that happens!

It happens after using "Remote Debugging" via e.g. eclipse in conjunction with atlas-debug, but it's not atlas-debug itself, it's only after actually debugging via eclipse.

After that, the project doesn't start again because of unresolved constraints and has to be cleaned.

Roman Samorodov
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.
January 25, 2017

@Nabil Sayegh I didn't debug my project in eclipse but I had this error.

Finally I solved this problem by adding <scope>provided</scope> to my dependencies.

Carlos David February 21, 2017

THANK YOU ROMAN!!

opysarenko June 27, 2019

@Roman Samorodov Thank you!!!!!!

0 votes
Deleted user April 18, 2016

I am facing the same error, missing package com.atlassian.plugin.spring.scanner.annotation.export. It is really funny since I have checked over and over again that it is correctly declared as a dependency on the project's pom.xml and that it has been correctly downloaded to the project's local repository.

Anyone could help me? Since JIRA 7 appeared, add-on development is a hell. Instead of JIRA showing normal errors that can be fixed by the add-on developer, it seems that it "invents" senseless errors that are not related to anything that could be happening actually.

;version="0";resolution:=optional

Roman Samorodov
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.
July 25, 2016

Add-on development is a hell...True true/

Like # people like this
0 votes
Tim Eddelbüttel
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.
October 21, 2015

I got the same within a Confluence Space Blueprint with the latest SDK.

Suggest an answer

Log in or Sign up to answer