无法从已安装的扩展中实例化类

无法从已安装的扩展中实例化类

本文介绍了通过OSGI运行时,无法从已安装的扩展中实例化类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有一个已安装的扩展程序(请参阅。

So, I have an installed extension (see http://docs.oracle.com/javase/tutorial/ext/basics/index.html) which I can see in Eclipse.

我写了一个简单的rcp尝试在此扩展中创建类实例的应用程序。但是,虽然一切都编译好,但在创建实例时我得到NoClassDefFoundError。

I've written a simple rcp application that tries to create an instance of a class in this extension. However, although everything compiles ok, I'm getting a NoClassDefFoundError when creating the instance.

我认为这与OSGi有关,因为我可以运行一个简单的java应用程序来创建实例。

I'm assuming this has something to do with OSGi because I can run a simple java application that creates the instance fine.

任何建议都会非常感激。

Any suggestions would be really appreciated.

谢谢

推荐答案

我找到了另一个解决方案,即使用arg将父类加载器设置为'ext'类加载器

I've found another solution which is to set the parent classloader to the 'ext' classloader using the arg

osgi.parentClassloader=ext

还不确定这种变化的影响除了我现在还没有得到错误。

Not sure yet the implications of such a change other than I now don't get the error.

这篇关于通过OSGI运行时,无法从已安装的扩展中实例化类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 13:51