Can't instantiate class from installed extension when run via OSGI

佐手、 提交于 2019-12-06 09:30:08

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.

As your extension's classes are being provided by the JRE, they need to be exported by the OSGi framework's system bundle.

This can be achieved by adding the package(s) to the org.osgi.framework.system.packages.extra property (you can set this as a system property and it will be passed into the framework).

Once this is done and your consuming bundle has those packages listed in the Import-Package entry of it's MANIFEST.MF, you should be able access the classes.

JRE extensions are almost the antithesis of OSGi - I'm curious to know why you're doing this?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!