我试图用他的OSGi(Equinox)环境构建一个使用E4的桌面应用程序。对于我的用户安全即时通讯使用Shiro。但我可以从我的OSGi加载类,但shiro不能!如何在使用Shiro时在OSGI E4环境中加载Class?
在我的包我试试这个:
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:无法加载类命名为
如何使用四郎到OSGi的发现与类名?
+1请同时举报一个针对Shiro的错误。没有Classloader的情况下,库不应该按名称加载类,因为这在模块化环境中总是失败。 –
真的很好!你在一周的研究后拯救我!非常感谢!你能报告四郎的错误吗?也许它打电话对修复它很有帮助。 – trouble
*(由新成员发表没有足够的代表留下评论)* @TomNelson写道:我有一个类似的解决方法相同的问题,所以我报告https://issues.apache.org/jira/browse/SHIRO-537 – Leigh