Hi, I'm willing to give reflection a try... seems like the best approach from a 24x7 standpoint, where I want to have the ability to change the impl and yet my parent is wired to the interface... or, so, that's my plan...
I was thinking about how OSGi does it (without digging in to the code, that is), and obviously the bundles work with classes loaded from each others bundles... so, it seems I want to mimic/duplicate that exact same functionality... how it does that, I haven't a clue... not sure if that's reflection, but if it is, I'd be willing to give it a shot... However, with all that said, I think the easiest way is what you suggest: Tweaking config.properties for 'org.osgi.framework.system.packages' (although, I like the reflection idea better...); Deiter, et al... the "service" portion of the debug prints didn't print anything? -- ------------------------------------------------------------- DEBUG:CL Context:WebappClassLoader delegate: false repositories: ----------> Parent Classloader: [EMAIL PROTECTED] DEBUG:CL Current:WebappClassLoader delegate: false repositories: ----------> Parent Classloader: [EMAIL PROTECTED] DEBUG:CL Service:7.0 ------------------------------------------------------------ Not sure what's up with that... Thanks again for your advisement(s) / assistance, Craig -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sahoo Sent: Tuesday, July 08, 2008 12:47 PM To: [email protected] Subject: Re: brain teaser - embedded felix / class cast exception Craig Phillips wrote: > Sahoo, Dieter, > > Yeah, this is what I'm suspecting and I'll try what you suggest, Deiter, > to print them out and I think I/we'll know the answer -- they were > loaded in two different class loaders... Note that they are from the > same package -- I built everything so everything is on the same page > from a compile/jar standpoint. > This is clear from the error message. > My parent is what creates the Felix container, so it is technically not > in a bundle, but I loaded the same class code in it's jar (since I'm > going to be using it, of course) -- although, design wise, I'm using the > <<interface>> not the <<Impl>>, but I short circuited the interface just > to get to the bottom of the riddle... This seems to be the problem. Felix does not use the class that's loaded by your code, which is running outside Felix. To fix it, you have to make both Felix and your code use the same class. Since your code runs before Felix and you probably don't want to use reflection to use that class, the only option that I can think of is to configure Felix to use your class by adding org.craig.cache to the list of packages exported by the parent class loader. The property name in config.property is: org.osgi.framework.system.packages. See OSGi documentation for more details about this property. Thanks, Sahoo
