You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Vincent Coupe <cu...@hotmail.com> on 2007/06/04 11:30:35 UTC
Problem Oscar -> Felix
Hi!
First, i am french, so i speak a bad english , sorry !
Then i got a big problem with Felix!
I have an application which works on Oscar! but if i want to use it in
Felix, i got lot of errors :(
I think its a problem of manifest but please help me !!
MANIFEST is :
Manifest-Version: 1.0
Bundle-Name: Bundle Video Client
Bundle-Activator: activator.Activator
Import-Service: demandeVideo.InterfaceTransfertVideo
Bundle-Version: 1.0
DynamicImport-Package: demandeVideo, org.osgi.framework;
specification-version=1.1
To use on felix, i added
Bundle-ManifestVersion: 2
Bundle-SymbolicName: bundlevideoclient
But i got error :
-> Exception in thread "Thread-3" java.lang.ClassCastException:
InterfaceFournisseurVideoImpl.InterfaceTransfertVideoImp
l
at
activator.Activator$ThreadSelectionAffichage.run(Activator.java:611)
Thanks for your help ! :)
Vincent.
_________________________________________________________________
Découvrez le Blog heroic Fantaisy d'Eragon!
http://eragon-heroic-fantasy.spaces.live.com/
Re: Problem Oscar -> Felix
Posted by "Richard S. Hall" <he...@ungoverned.org>.
Hello Vincent,
> First, i am french, so i speak a bad english , sorry !
Don't worry, I have a lot of experience in this area... ;-)
> Then i got a big problem with Felix!
> I have an application which works on Oscar! but if i want to use it in
> Felix, i got lot of errors :(
> I think its a problem of manifest but please help me !!
>
> MANIFEST is :
> Manifest-Version: 1.0
> Bundle-Name: Bundle Video Client
> Bundle-Activator: activator.Activator
> Import-Service: demandeVideo.InterfaceTransfertVideo
> Bundle-Version: 1.0
> DynamicImport-Package: demandeVideo, org.osgi.framework;
> specification-version=1.1
Definitely, as Niclas said, you want to do "Import-Package:
org.osgi.framework..."...
> To use on felix, i added
> Bundle-ManifestVersion: 2
> Bundle-SymbolicName: bundlevideoclient
>
> But i got error :
> -> Exception in thread "Thread-3" java.lang.ClassCastException:
> InterfaceFournisseurVideoImpl.InterfaceTransfertVideoImp
> l
> at
> activator.Activator$ThreadSelectionAffichage.run(Activator.java:611)
>
> Thanks for your help ! :)
And also as Niclas said, this is not enough information for me to figure
it out.
Typically speaking, the main differences that impact bundles when switch
from Oscar to Felix are:
1. Your bundles must import every external package they use except
java.* in Felix.
2. Classes on the class path are no longer automatically accessible
to the bundles.
Admittedly, these two issues are related.
My guess is that you are falling victim of (2). You probably didn't get
your class cast exception under Oscar because your classes were also
available on the class path so your bundles were always getting the same
definition via the parent class loader. If that were true, then this
would no longer be the case under Felix.
Of course, this is just a guess.
Investigate a little more. Make sure that all bundles have contain the
packages they should and make sure that all imports and exports are
explicit. If you still cannot figure it out, you can email me
(privately) a minimal set of bundles to reproduce the issue.
-> richard
Re: Problem Oscar -> Felix
Posted by Niclas Hedhman <ni...@hedhman.org>.
On Monday 04 June 2007 17:30, Vincent Coupe wrote:
> Import-Service: demandeVideo.InterfaceTransfertVideo
Very unlikely that you will need this. If you are not sure that you need it,
take it away.
> DynamicImport-Package: demandeVideo, org.osgi.framework;
> specification-version=1.1
DynamicImport is only recommended for special case, and I suspect that you
would do just fine with Import-Package instead. No matter, org.osgi.framework
should always be imported via Import-Package and not dynamic package.
> Bundle-ManifestVersion: 2
When you do this, you trigger all the requirements of R4 Manifests.
> Bundle-SymbolicName: bundlevideoclient
correct.
> But i got error :
> -> Exception in thread "Thread-3" java.lang.ClassCastException:
> InterfaceFournisseurVideoImpl.InterfaceTransfertVideoImp
You have not provided enough information to know this for sure, but
GutFeeling(tm) says that you have been relying on "Exported Packages are
automatically Imported" which was the case in R3 (Oscar), and now requires
explicit Import-Package. And if you then have the above class (or perhaps
some of its superclass) loaded internally also is provided in some manner
which has had its class loaded from another bundle exporting the same
package. In R3, only one of the packages would be used, but this is not the
case in R4, if you don't Import what you Export.
Hope that helps.
Cheers
--
Niclas Hedhman, Software Developer
I live here; http://tinyurl.com/2qq9er
I work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug