为什么bc.getServiceReference(HttpService.class.getName()),取到了null ? 网上有说是HttpService没有注册,在哪里注册呢?public class Activator implements BundleActivator{
private ServiceReference httpServiceRef;
public void start( BundleContext bc ) throws Exception {
httpServiceRef = bc.getServiceReference(HttpService.class.getName());
System.out.println(httpServiceRef);
//输出了Null
//......
private ServiceReference httpServiceRef;
public void start( BundleContext bc ) throws Exception {
httpServiceRef = bc.getServiceReference(HttpService.class.getName());
System.out.println(httpServiceRef);
//输出了Null
//......
lz看完应该就知道了。public void start(BundleContext context) throws Exception {
Properties props = new Properties();
props.put("ClassRoom", "ClassOne");
context.registerService(
NameService.class.getName(), new NameImpl(), props);
}