对OSGi来说是新手。我想在春季从osgi那里获得一项服务。代码的Git链接:获取ClassCastException。
java.lang.ClassCastException: com.bundle.Activator cannot be cast to com.myInterface.BundleInterface
at com.osgi.OSGiLauncher.lambda$0(OSGiLauncher.java:39)
at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback
我正在探索OSGI在过去几周是如何实现的。我知道每个包都使用自己的类加载器来加载它的类。作为我调查的一部分,我了解到每个包的类加载器的父类都是空的,即引导类加载器。
System.out.println("ClassInBundle class is loaded by "+ClassInBundle.class.getClassLoader());
System.out.println("ClassInBundle parent class is "+ClassInBundle.class.getClassLoader().getParent());
samp
在处理将OSGi嵌入到应用程序/库、在运行时加载包、然后在宿主应用程序/库中使用该包时,我有点迷失了。
这是从我的主机加载包的代码:
// framework is the embedded OSGi framework
Bundle b = framework.getBundleContext().installBundle( "file:/project_dir/bundle/MyBundle.jar" );
b.start();
这个包由一些非常简单的东西组成:
public class Activator implements BundleActivator
{
@
我是OSGi的新手,正在构建第一个DS实现。
所有的代码都是根据"the book“编写的,但在运行时,我得到了这个错误:
java.lang.InstantiationException: com.mine.logger.internal.udp.UdpListener
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.create
我正在制作一个捆绑包来插入OSGi,为用户提供一个功能:
Usercase: User input the classname string and click "list" button, the corresponding class will be decompiled and show the text on GUI for user.
所以这里是我的问题:我只有我的包的类加载器,我如何才能获得OSGi容器类加载器,这样我就可以从整个OSGi容器中按名称加载类?(我期望当OSGi启动时,它会将所有包和所有类加载到内存中,任何类都可以由OSGi容器类加载器加载,如果它确实
我正在尝试在OSGI中运行Apache Wink,并使用Felix白板将资源注册为服务。在极简主义的OSGI环境中,捆绑包按预期工作。但是,然后我将这个包转移到了Eclipse Equinox环境中,在那里我正在开发一个依赖于它的插件。我开始收到这个错误。
May 22, 2013 11:19:59 AM org.apache.wink.server.internal.application.ApplicationProcessor processWinkApplication
SEVERE: An exception occurred during processing of the com