我正在尝试使用 E4 和他的 OSGi(Equinox) 环境构建桌面应用程序。对于我的用户安全,我正在使用 Shiro。但我可以从我的 OSGi 加载类,但 shiro 不能!
在我的捆绑包中,我尝试了这个:
初始化激活器.java:
public class InitActivator implements BundleActivator {
private static BundleContext context;
static BundleContext getContext() {
return context;
}
@Override
public void start(BundleContext context) throws Exception {
//1. OSGi loadClass function
System.err.println(context.getBundle().loadClass("com.firm.demo.MyCustomClass")
.getName());
//2. Using Apache Shiro ClassUtils
System.err.println("Shiro : " + ClassUtils.forName("com.firm.demo.MyCustomClass"));
}
}
1. system.err用他的限定名返回正确的类。2.system.err返回一个org.apache.shiro.util.UnknownClassException: Unable to load class named
我如何在 OSGi 中使用 Shiro 来查找具有名称的类?