java - 使用 Apache Felix iPOJO 事件管理处理程序

标签 java event-handling osgi apache-felix ipojo

我想使用Event Admin Handlers .

我正在尝试运行以下代码:

import org.apache.felix.ipojo.handlers.event.Publishes;
import org.apache.felix.ipojo.handlers.event.Subscriber;
import org.apache.felix.ipojo.handlers.event.publisher.Publisher;
...
@Component(immediate = true, publicFactory = false)
@Provides(specifications = {Test.class})
@Instantiate
public class Test {
...
    @Publishes(name = "myPublisher", topics = "foo")
    private Publisher m_publisher;
...
    @Subscriber(name = "mySubscriber", topics = "foo")
    public void receive(Event pEvent) {
    ...
    }
}

但是有错误:

! instances
...
Instance test.Test-0 -> invalid
...

! instance test.Test-0
gogo: NullPointerException: null

据我了解,无法获取发布者组件的实例。我有 Activity 的“Apache Felix iPOJO 事件管理处理程序 (1.8.0)” bundle 。

用途:

  • Apache 菲利克斯 4.2.1
  • org.apache.felix.ipojo.annotations (1.11.0)
  • org.apache.felix.ipojo.api (1.11.0)
  • org.apache.felix.ipojo.handler.eventadmin (1.8.0)

出了什么问题?谢谢。

<小时/>

这是捆绑列表:

! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.2.1)
    1|Active     |    1|Commons Codec (1.8.0)
    4|Active     |    1|Commons IO (2.4.0)
    5|Active     |    1|Commons Lang (2.6.0)
    6|Active     |    1|Commons Lang (3.1.0)
    7|Active     |    1|jcl-over-slf4j (1.7.5)
   10|Active     |    1|Apache Felix Bundle Repository (1.6.6)
   12|Active     |    1|Apache Felix Gogo Command (0.12.0)
   13|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
   14|Active     |    1|Apache Felix Gogo Shell (0.10.0)
   15|Active     |    1|Apache Felix iPOJO (1.11.0)
   16|Active     |    1|Apache Felix iPOJO API (1.11.0)
   17|Active     |    1|Apache Felix iPOJO Gogo Command (1.11.0)
   18|Active     |    1|Apache Felix iPOJO Event Admin Handler (1.8.0)
   19|Active     |    1|osgi.cmpn (4.2.0.200908310645)
   20|Active     |    1|slf4j-api (1.7.5)

最佳答案

首先,收集实例架构时发生的 NPE 是一个错误。您可以在 https://issues.apache.org/jira/browse/FELIX 上提出问题吗?

那么,看来您没有部署事件管理。您可以从http://felix.apache.org/downloads.cgi下载.

克莱门特

关于java - 使用 Apache Felix iPOJO 事件管理处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19875139/

相关文章:

java - 在 Android 中跨不同模块访问代码?

java - 简单 Java 程序的启动导致白屏暂停

解析网站以返回玩家列表的 Java 代码不会返回任何内容

java - 检测图中的奇点

c# - 递归 SharePoint 事件处理程序

java - 如何使用Spring通过id获取osgi服务?

java - 私有(private)包 list header 有什么作用?

javascript - 使用 jquery 强制事件连续触发的模式

c# - 在 CQRS 中注册 EventHandler

grails - Karaf 4上的Grails3。有人设法做到了吗?