• Community
  • Products
  • Jira
  • Questions
  • Why am I getting "Unresolved constraint in bundle" exceptions after I migrated development environment to support JIRA7

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

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

19 votes
Accepted answer

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>

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.

@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.

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.

importing the packages has worked for me as well

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

thanks

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

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>


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

Awesome!

Adding 

;version="0";resolution:=optional

 after the * fixed it for me too! 

Thanks!

Thanks, that worked.

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

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/

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).

Delete the target directory saved my day.

Thanks Koen !

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!!!!!

 

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>

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.

Try

atlas-mvn clean

wink

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

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

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

 

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.

@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.

THANK YOU ROMAN!!

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

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

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,887 views 19 22
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you