Craig:Something you could try to figure out what is going wrong with classloading is to debug print the associated classloaders. This information could indicate what is actually going wrong.
In particular, it would be interesting to see the output of the following:
Object o = bc.getService(sr);System.out.println("DEBUG:CL Context:" + Thread.currentThread().getContextClassLoader().toString()); System.out.println("DEBUG:CL Current:" + this.getClass().getClassLoader().toString()); System.out.println("DEBUG:CL Service:" + o.getClass().getClassLoader().toString());
Regards, Dieter
Here's the line of code:CacheServiceMain cacheServiceMain = (CacheServiceMain) bc.getService(sr)
Hi,Can't cast a class to it's own type... Huh? I just got to believe it's some kind of class loader thing going on... I really could use a pair ofeyes from one of the class loader experts out there, I anticipate (I brought other eyes nearby to look, they're stumped too)... Thanks, Craig Phillips Here's the stack error message:java.lang.ClassCastException: org.craig.cache.CacheServiceMain cannot becast to org.craig.cache.CacheServiceMain Here's the line of code:CacheServiceMain cacheServiceMain = (CacheServiceMain) bc.getService(sr)Here's the context snippet, that creates the felix container, more or less: System.getProperties().setProperty(Main.CONFIG_PROPERTIES_PROP, "file:../webapps/craigbox/WEB-INF/felix_config.properties"); Main.loadSystemProperties(); Properties configProps = Main.loadConfigProperties(); List<AutoActivator> list = new ArrayList<AutoActivator>(); // pass through list.add(new AutoActivator(configProps)); // pass through Map map = new StringMap(configProps, false); // pass through felix = new Felix(map, list); // there isn't a default constructor felix.start(); BundleContext bc = felix.getBundleContext(); ServiceReference sr = bc.getServiceReference("org.craig.cache.api.CacheServiceMainApi"); if (sr != null) { CacheServiceMain cacheServiceMain = (CacheServiceMain) bc.getService(sr); ... // and the rest, which of course doesn't come in to playPS - To Karl -- As you can tell, I have not done the "set TCL to null", but this is in the "parent" code... Note that I do have all the classesin the parent dot.jar file, if that's any consolation...
smime.p7s
Description: S/MIME cryptographic signature
