【发布时间】:2013-12-18 08:35:19
【问题描述】:
我正在尝试使用 E4 和他的 OSGi(Equinox) 环境构建桌面应用程序。对于我的用户安全,我正在使用 Shiro。但我可以从我的 OSGi 加载类,但 shiro 不能!
在我的 Bundle 中我试试这个:
InitActivator.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 来查找具有名称的类?
【问题讨论】: