OsgiServiceProxyFactoryBean factory = new OsgiServiceProxyFactoryBean();
factory.setBundleContext(getBundleContext());
factory.setBeanClassLoader(classLoader);
factory.setFilter(filter);
factory.setInterfaces(new Class[] { ClassUtils.resolveClassName(className, classLoader) });
factory.afterPropertiesSet();
return factory.getObject();
} catch (org.springframework.osgi.service.ServiceUnavailableException e) {
NameNotFoundException ex = new NameNotFoundException(e.getMessage());
ex.initCause(e);
throw ex;