You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Roland <wg...@ids.de> on 2013/05/02 12:36:14 UTC

Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Dear community,

Once again the well-known problem: 
So far I could not find an answer for my problem because I have a completely
different problem than it could be assumed with regard to this error
message. (And i am a newbie...)

I am currently integrating OSGi into an existing application. I *embed* the
framework "Apache Felix 4.3", and i use the maven-bundle-plugin to generate
the manifests. From my own Felix-launcher I run multiple bundles, which
provide various services. In addition, the start-method of the systembundle
registers some services too. The systembundle exports the necessary packages
that contain interfaces of provided services. This works so far.

Now I have a new bundle that requires a package of the systembundle
(respectively a interface of a provided service).



When I start the new bundle I get the error "Unresolved constraint in
bundle...", which indicates that the systembundle does not export the
package (correctly?). But I can see the exports in the Manifest of the
systembundle-jar. I can also see the services of the required package with
the "inspect c service <id>" shell command. The packages are exported and
the services are working.
I tried to solve the problem by adding the property  to my felix, but this
does not solve the problem  because the packages are already and definitely
exported. I also checked the wildcards of import and export clauses. I also
excluded the exported package from the private packages and so on.
So the error is not due to:
-Missing exports and imports
-faulty export or import clauses (wrong wildcards, etc.)
-faulty manifest or POM.

My guess is that the dependencies are not resolved during the Felix-startup.
This either results from the OSGi specification or from the Felix
implementation. I could not find the relevant text passage in the
specifications so far. Maybe someone can give me a reference where I can
find the appropriate information.

The short-term solution to my problem is to switch from  to . I also exclude
the dynamically imported packages in the  clause. Now, my Felix-launcher
starts the new bundle correctly without an error message. However, I want to
avoid dynamic imports. Dynamic imports indicate a non-modular architecture.

Am I right with my assumption that the problem is related to the boot
process of the felix-lauchner? Could someone explain the problem in a
general way and how to avoid this, please. 

(And I don't want to use "Lazy activation".)

Thank you very much!
Roland



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Posted by Neil Bartlett <nj...@gmail.com>.
Neither Richard nor I can help you further unless you show the actual specific error message(s), and the output of the inspect command that I asked you to run (just the relevant lines please). 

Neil  

-- 
Neil Bartlett
Sent from a phone


On Friday, 3 May 2013 at 08:34, Roland wrote:

> Neil Bartlett wrote
> > In addition to what Richard said, you can inspect the actual exports
> > of the system bundle as follows:
> > 
> > inspect cap osgi.wiring.package 0
> > 
> > This should reveal pretty quickly that the packages you think are
> > exported are not actually exported.
> > 
> > Regards,
> > Neil
> > 
> 
> 
> Tank you for your reply!
> 
> I run the command as you recommended me. The required package is definitly
> exported, but it is unused. Because the only bundle which requires this
> package, is resolved due to an unresolved constraint to this package during
> startup. Something is going wrong with my felix-lauchner.
> The only solution is a dynamic import of packages. Thus, the packages are
> loaded after the framework has been booted up completely.
> 
> Has someone ever had a similar behavior?
> 
> Regards to all,
> Roland
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141p5003162.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 



Re: Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Posted by Roland <wg...@ids.de>.
Neil Bartlett wrote
> In addition to what Richard said, you can inspect the actual exports
> of the system bundle as follows:
> 
>     inspect cap osgi.wiring.package 0
> 
> This should reveal pretty quickly that the packages you think are
> exported are not actually exported.
> 
> Regards,
> Neil

Tank you for your reply!

I run the  command as you recommended me. The required package is definitly
exported, but it is unused. Because the only bundle which requires this
package, is resolved due to an unresolved constraint to this package during
startup. Something is going wrong with my felix-lauchner.
The only solution is a dynamic import of packages. Thus, the packages are
loaded after the framework has been booted up completely.

Has someone ever had a similar behavior?

Regards to all,
Roland



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141p5003162.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Posted by Neil Bartlett <nj...@gmail.com>.
In addition to what Richard said, you can inspect the actual exports
of the system bundle as follows:

    inspect cap osgi.wiring.package 0

This should reveal pretty quickly that the packages you think are
exported are not actually exported.

Regards,
Neil

On Thu, May 2, 2013 at 4:15 PM, Richard S. Hall <he...@ungoverned.org> wrote:
>
> On 5/2/13 06:36 , Roland wrote:
>>
>> Dear community,
>>
>> Once again the well-known problem:
>> So far I could not find an answer for my problem because I have a
>> completely
>> different problem than it could be assumed with regard to this error
>> message. (And i am a newbie...)
>>
>> I am currently integrating OSGi into an existing application. I *embed*
>> the
>> framework "Apache Felix 4.3", and i use the maven-bundle-plugin to
>> generate
>> the manifests. From my own Felix-launcher I run multiple bundles, which
>> provide various services. In addition, the start-method of the
>> systembundle
>> registers some services too. The systembundle exports the necessary
>> packages
>> that contain interfaces of provided services. This works so far.
>>
>> Now I have a new bundle that requires a package of the systembundle
>> (respectively a interface of a provided service).
>>
>>
>>
>> When I start the new bundle I get the error "Unresolved constraint in
>> bundle...", which indicates that the systembundle does not export the
>> package (correctly?). But I can see the exports in the Manifest of the
>> systembundle-jar. I can also see the services of the required package with
>> the "inspect c service <id>" shell command. The packages are exported and
>> the services are working.
>
>
> The manifest of the framework plays no role in what the system bundle
> exports. You must use the org.osgi.framework.system.packages.extra
> configuration property.
>
>
>> I tried to solve the problem by adding the property  to my felix,
>
>
> Which property and how did you add it?
>
>
>>   but this
>> does not solve the problem  because the packages are already and
>> definitely
>> exported. I also checked the wildcards of import and export clauses. I
>> also
>> excluded the exported package from the private packages and so on.
>> So the error is not due to:
>> -Missing exports and imports
>> -faulty export or import clauses (wrong wildcards, etc.)
>> -faulty manifest or POM.
>>
>> My guess is that the dependencies are not resolved during the
>> Felix-startup.
>> This either results from the OSGi specification or from the Felix
>> implementation. I could not find the relevant text passage in the
>> specifications so far. Maybe someone can give me a reference where I can
>> find the appropriate information.
>>
>> The short-term solution to my problem is to switch from  to . I also
>> exclude
>> the dynamically imported packages in the  clause. Now, my Felix-launcher
>> starts the new bundle correctly without an error message. However, I want
>> to
>> avoid dynamic imports. Dynamic imports indicate a non-modular
>> architecture.
>>
>> Am I right with my assumption that the problem is related to the boot
>> process of the felix-lauchner?
>
>
> Probably not. My guess is you are doing something wrong.
>
> -> richard
>
>
>> Could someone explain the problem in a
>> general way and how to avoid this, please.
>>
>> (And I don't want to use "Lazy activation".)
>>
>> Thank you very much!
>> Roland
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141.html
>> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Posted by Roland <wg...@ids.de>.
Richard S. Hall wrote
> Are you are saying that "." is the package you are trying to export? 
> That won't work, "." is not a package. If you are trying to export the 
> default package, that is not possible.
> 
> -> richard

Hello Richard,
I'm sorry if I did not clearly describe what is going on. I just post the
code...

here is my felix-launcher...


Many thanks for your help!!

bye



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141p5003179.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 5/3/13 02:59 , Roland wrote:
> Richard S. Hall wrote
>> The manifest of the framework plays no role in what the system bundle
>> exports. You must use the org.osgi.framework.system.packages.extra
>> configuration property.
>>
>>> I tried to solve the problem by adding the property  to my felix,
>> Which property and how did you add it?
> Thank you for your reply!
>
> I tried to fix the problem by adding the property .  is the required
> package. But this didn't solved the problem as i wrote yesterday.

Are you are saying that "." is the package you are trying to export? 
That won't work, "." is not a package. If you are trying to export the 
default package, that is not possible.

-> richard
>
>
>
>
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141p5003160.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Posted by Roland <wg...@ids.de>.
Richard S. Hall wrote
> The manifest of the framework plays no role in what the system bundle 
> exports. You must use the org.osgi.framework.system.packages.extra 
> configuration property.
> 
>> I tried to solve the problem by adding the property  to my felix,
> 
> Which property and how did you add it?

Thank you for your reply!

I tried to fix the problem by adding the property .  is the required
package. But this didn't solved the problem as i wrote yesterday.




--
View this message in context: http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141p5003160.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 5/2/13 06:36 , Roland wrote:
> Dear community,
>
> Once again the well-known problem:
> So far I could not find an answer for my problem because I have a completely
> different problem than it could be assumed with regard to this error
> message. (And i am a newbie...)
>
> I am currently integrating OSGi into an existing application. I *embed* the
> framework "Apache Felix 4.3", and i use the maven-bundle-plugin to generate
> the manifests. From my own Felix-launcher I run multiple bundles, which
> provide various services. In addition, the start-method of the systembundle
> registers some services too. The systembundle exports the necessary packages
> that contain interfaces of provided services. This works so far.
>
> Now I have a new bundle that requires a package of the systembundle
> (respectively a interface of a provided service).
>
>
>
> When I start the new bundle I get the error "Unresolved constraint in
> bundle...", which indicates that the systembundle does not export the
> package (correctly?). But I can see the exports in the Manifest of the
> systembundle-jar. I can also see the services of the required package with
> the "inspect c service <id>" shell command. The packages are exported and
> the services are working.

The manifest of the framework plays no role in what the system bundle 
exports. You must use the org.osgi.framework.system.packages.extra 
configuration property.

> I tried to solve the problem by adding the property  to my felix,

Which property and how did you add it?

>   but this
> does not solve the problem  because the packages are already and definitely
> exported. I also checked the wildcards of import and export clauses. I also
> excluded the exported package from the private packages and so on.
> So the error is not due to:
> -Missing exports and imports
> -faulty export or import clauses (wrong wildcards, etc.)
> -faulty manifest or POM.
>
> My guess is that the dependencies are not resolved during the Felix-startup.
> This either results from the OSGi specification or from the Felix
> implementation. I could not find the relevant text passage in the
> specifications so far. Maybe someone can give me a reference where I can
> find the appropriate information.
>
> The short-term solution to my problem is to switch from  to . I also exclude
> the dynamically imported packages in the  clause. Now, my Felix-launcher
> starts the new bundle correctly without an error message. However, I want to
> avoid dynamic imports. Dynamic imports indicate a non-modular architecture.
>
> Am I right with my assumption that the problem is related to the boot
> process of the felix-lauchner?

Probably not. My guess is you are doing something wrong.

-> richard

> Could someone explain the problem in a
> general way and how to avoid this, please.
>
> (And I don't want to use "Lazy activation".)
>
> Thank you very much!
> Roland
>
>
>
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Posted by Roland <wg...@ids.de>.
Neil Bartlett wrote
> Roland, what email software are you using?? It looks like large
> segments of your messages are completely missing. This was probably
> the reason for much of our confusion.
> 
> Anyway, I'm glad you got your problem fixed, although it's still a
> mystery what the problem was and how you fixed it.
> 
> Regards,
> Neil

Hello Neil,
The Problem was that i started several other Bundles from my systembundle
activator start method. The system bundle must have completed the startup
process before any other bundles. So the order of the start-up process was
not correct.
In my case the state of my systembundle was "STARTING". The required
packages had not been exported yet. So i got a "unresolved
constraints"-error in a other bundle. The systembundle has to be in state
"ACTIVE" to resolve constraints properly. If i start bundles in my
systembundle activator start method i have to take care that the constraints
are resolved later by importing dependencies dynamically or i transfer the
startup-sourcecode from my systembundles activater start method to anywhere
else than in the systembundle activator start method. The latter I did to
solve the problem.

Regards,
Roland



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141p5003215.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Posted by Stuart McCulloch <mc...@gmail.com>.
On 3 May 2013, at 16:26, Neil Bartlett wrote:

> Roland, what email software are you using??

AFAICT it came from Nabble which is known to strip out random content (typically XML) when it posts the message upstream, though it looks ok when viewed from Nabble:

	http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141p5003179.html

> It looks like large
> segments of your messages are completely missing. This was probably
> the reason for much of our confusion.
> 
> Anyway, I'm glad you got your problem fixed, although it's still a
> mystery what the problem was and how you fixed it.
> 
> Regards,
> Neil
> 
> On Fri, May 3, 2013 at 3:01 PM, Roland <wg...@ids.de> wrote:
>> Hello everyone,
>> i solved my problem...
>> 
>> Error Cause:
>> I started all other bundles from the system bundle activator start method.
>> The state of the system bundle is
>> Therefore, the constraints can not be resolved properly.
>> 
>> beginner's mistake!
>> 
>> Thank you all for your help!
>> 
>> bye
>> 
>> --
>> View this message in context: http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141p5003193.html
>> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Posted by Neil Bartlett <nj...@gmail.com>.
Roland, what email software are you using?? It looks like large
segments of your messages are completely missing. This was probably
the reason for much of our confusion.

Anyway, I'm glad you got your problem fixed, although it's still a
mystery what the problem was and how you fixed it.

Regards,
Neil

On Fri, May 3, 2013 at 3:01 PM, Roland <wg...@ids.de> wrote:
> Hello everyone,
> i solved my problem...
>
> Error Cause:
> I started all other bundles from the system bundle activator start method.
> The state of the system bundle is
> Therefore, the constraints can not be resolved properly.
>
> beginner's mistake!
>
> Thank you all for your help!
>
> bye
>
>
>
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141p5003193.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Package constraints are not resolved during Framework startup. Unresolved constraint in bundle...

Posted by Roland <wg...@ids.de>.
Hello everyone,
i solved my problem...

Error Cause:
I started all other bundles from the system bundle activator start method.
The state of the system bundle is 
Therefore, the constraints can not be resolved properly.

beginner's mistake!

Thank you all for your help!

bye



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Package-constraints-are-not-resolved-during-Framework-startup-Unresolved-constraint-in-bundle-tp5003141p5003193.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org