You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by derekv <de...@yahoo.com> on 2009/04/13 17:49:09 UTC

Unresolved constraint question

I am trying to take an existing application and get it to run on apache
felix. I get the following error:

-> ERROR: Error starting
file:E:/Documents/projects/ProjectProxyServer/ProxyServer.jar
(org.osgi.framework.BundleException: Unresolved constraint in bundle 6:
package; (&(package=com.sun.net.ssl.internal.ssl)(version>=0.0.0)))
org.osgi.framework.BundleException: Unresolved constraint in bundle 6:
package; (&(package=com.sun.net.ssl.internal.ssl)(version>=0.0.0))
	at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3090)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1439)
	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984)
	at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
	at java.lang.Thread.run(Thread.java:619)

My manifest looks like this:

Manifest-Version: 1.0
Main-Class: org.dav.proxy.ProxyServer
Bundle-Activator: org.dav.proxy.ProxyServerActivator
Import-Package: org.osgi.framework,javax.swing,javax.net.ssl
Bundle-ClassPath: .,ProxyNet.jar

I tried this in the configuration file:

org.osgi.framework.system.packages.extra=sun.*,com.sun.*,com.sun.net.ssl.internal.ssl.*

and i tried this:

org.osgi.framework.system.packages=com.sun.net.ssl.internal.ssl.*

and i tried this:

org.osgi.framework.bootdelegation=sun.*,com.sun.*,com.sun.net.ssl.internal.ssl.*

I cant seem to find any way to make this work.
This seems like i am probably missing something very simple.
any help would be greatly appreciated.
thanks.
-- 
View this message in context: http://www.nabble.com/Unresolved-constraint-question-tp23024174p23024174.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: Unresolved constraint question

Posted by derekv <de...@yahoo.com>.


Stuart McCulloch wrote:
> 
> 2009/4/13 derekv <de...@yahoo.com>
>> I tried this in the configuration file:
>>
>>
>> org.osgi.framework.system.packages.extra=sun.*,com.sun.*,com.sun.net.ssl.internal.ssl.*
>>
> 
> note this property only works with recent releases of Felix (1.4 and
> later)
> and AFAIK it doesn't support wildcards - so you need to put the exact list
> of additional packages, like:
> 
>    org.osgi.framework.system.packages.extra=\
>       com.sun.net.ssl,\
>       com.sun.net.ssl.internal.ssl,\
>       ...etc...
> 

Hey, yeah, i took out the wild cards and it worked.
I figured it was something small i was doing wrong.
Its the little details that get you every time.

thanks!
-- 
View this message in context: http://www.nabble.com/Unresolved-constraint-question-tp23024174p23038656.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: Unresolved constraint question

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/4/13 derekv <de...@yahoo.com>

>
> I am trying to take an existing application and get it to run on apache
> felix. I get the following error:
>
> -> ERROR: Error starting
> file:E:/Documents/projects/ProjectProxyServer/ProxyServer.jar
> (org.osgi.framework.BundleException: Unresolved constraint in bundle 6:
> package; (&(package=com.sun.net.ssl.internal.ssl)(version>=0.0.0)))
> org.osgi.framework.BundleException: Unresolved constraint in bundle 6:
> package; (&(package=com.sun.net.ssl.internal.ssl)(version>=0.0.0))
>        at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3090)
>        at org.apache.felix.framework.Felix.startBundle(Felix.java:1439)
>        at
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984)
>        at
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
>        at java.lang.Thread.run(Thread.java:619)
>
> My manifest looks like this:
>
> Manifest-Version: 1.0
> Main-Class: org.dav.proxy.ProxyServer
> Bundle-Activator: org.dav.proxy.ProxyServerActivator
> Import-Package: org.osgi.framework,javax.swing,javax.net.ssl
> Bundle-ClassPath: .,ProxyNet.jar
>

is that the manifest extracted from the bundle? it doesn't mention the
"com.sun..." constraint

could you try using this command in the Felix console:

   headers 6

(or whatever bundle number appears in the exception next time) and paste the
result into a reply

could you also let us know which version of Felix you're using :)

I tried this in the configuration file:
>
>
> org.osgi.framework.system.packages.extra=sun.*,com.sun.*,com.sun.net.ssl.internal.ssl.*
>

note this property only works with recent releases of Felix (1.4 and later)
and AFAIK it doesn't support wildcards - so you need to put the exact list
of additional packages, like:

   org.osgi.framework.system.packages.extra=\
      com.sun.net.ssl,\
      com.sun.net.ssl.internal.ssl,\
      ...etc...

and i tried this:
>
> org.osgi.framework.system.packages=com.sun.net.ssl.internal.ssl.*
>

this is not correct as it will completely replace the system bundle exports
so you won't get packages like "org.omg..." and "javax.swing..." from the
system bundle, only the com.sun... package

when using "org.osgi.framework.system.packages" you need to give it
the entire list of packages you expect exported from the system bundle,
( which is why "org.osgi.framework.system.packages.extra" is better :)

and i tried this:
>
>
> org.osgi.framework.bootdelegation=sun.*,com.sun.*,com.sun.net.ssl.internal.ssl.*
>

this won't solve a missing import constraint - bootdelegation just means
that the bundle classloader will delegate to the boot classloader first for
the named packages, it isn't involved in the constraint checking

if your bundle has a non-optional import then some bundle must export it
(either the same bundle, the system bundle, or another bundle altogether)

however you can use bootdelegation to solve a missing package as long
as you remove the import from the bundle (ie. remove "com.sun..." from
Import-Package in the manifest and add "com.sun.*" to bootdelegation)

then the OSGi framwork won't bother wiring this package, and it will find
it via bootdelegation (ie. like a classic Java app) - downside is you can't
have multiple versions of the package or upgrade it without restarting

I cant seem to find any way to make this work.
> This seems like i am probably missing something very simple.
> any help would be greatly appreciated.


I think the first step is to find out where the
"com.sun.net.ssl.internal.ssl"
constraint is coming from (as it isn't in the manifest shown about, but it
must be in the manifest seen by the framework, otherwise it wouldn't be
checking the constraint)

another thing to look into is should this really be an import constraint
because it ties the bundle to the Sun JDK (it's a Sun implementation
package) - finding out how it got into the manifest will help

to sum up:

if you decide to leave "com.sun.net.ssl.internal.ssl" as an import you
must add this package to "org.osgi.framework.system.packages.extra"
(note, no wildcards)

if you decide to remove "com.sun.net.ssl.internal.ssl" as an import
you can add this to "org.osgi.framework.bootdelegation" instead

because (for some reason) your bundle needs this implementation
package to work you also need to ensure you run with a Sun JVM

thanks.


-- 
Cheers, Stuart