【问题标题】:How can I debug a missing NamespaceHandler in Aries Blueprint running in Karaf?如何调试在 Karaf 中运行的 Aries 蓝图中缺少的 NamespaceHandler?
【发布时间】:2020-02-23 04:01:16
【问题描述】:

我一遍又一遍地争论这个问题。归结为:

如何调试在 Apache Karaf 中运行的 Aries 蓝图?

我最终得到来自 diag 的输出,它仅暗示 XML 命名空间 http://camel.apache.org/schema/blueprint/cxf 找不到有效模式这一事实。顺便说一下,文档架构 URL 是 http://camel.apache.org/schema/blueprint/camel-cxf-blueprint.xsd

Status: GracePeriod
Declarative Services
Blueprint
10/27/19 4:52 PM
Missing dependencies:
(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://camel.apache.org/schema/blueprint/cxf))

是的,camel-cxf 正在运行。但是我怎样才能看到到底出了什么问题呢?

我在 IBM 文档中找到了这个注释:

蓝图运行时解析蓝图描述符两次。第一遍很快,只找到蓝图包使用的每个命名空间。如果蓝图包使用非标准名称空间,则蓝图容器会尝试在 OSGi 服务注册表中为每个自定义名称空间定位 NamespaceHandler 服务。 NamespaceHandler 服务通过使用 OSGi 服务属性来通告它可以处理的每个 xml 命名空间。蓝图运行时不会解析蓝图 xml,直到可以为包中使用的每个自定义命名空间找到 NamespaceHandler 服务。除非可以为每个自定义命名空间找到 NamespaceHandler 服务,否则蓝图容器无法处理捆绑包。此结果可能意味着如果不存在 NamespaceHandler,则蓝图容器会无限期地等待。如果遇到这种情况,那么蓝图容器会向日志发出警告。当蓝图解析器开始解析蓝图 xml 文件时,它会解析任何标准蓝图元素。当解析器到达一个自定义元素时,解析器会调用 NamespaceHandler 来宣传对自定义元素的命名空间的支持。在这里,NamespaceHandler 有机会处理自定义元素中的信息、修改运行时蓝图模型或执行任何其他操作。如果在任何命名空间定义中出现输入错误,那么蓝图几乎肯定无法启动。

https://www.ibm.com/support/knowledgecenter/SSD28V_liberty/com.ibm.websphere.wlp.core.doc/ae/rwlp_blueprint_namespace_handler.html

【问题讨论】:

    标签: apache-camel apache-karaf blueprint-osgi


    【解决方案1】:

    这是我最好的答案,但我希望更有经验的人提供更好的答案。

    我怀疑另一个蓝图实例可能对我不利。

    我在 Karaf 中运行了 list -t 0 -s | grep blueprint,发现有两个不同的 blueprint.apiblueprint.core 实例正在运行。这是罪魁祸首吗?我不知道。我不知道如何在 Karaf 中调试这种东西。

     69 │ Active      │  20 │ 1.0.1              │ org.apache.aries.blueprint.api
     70 │ Active      │  20 │ 1.3.1              │ org.apache.aries.blueprint.cm
     71 │ Active      │  20 │ 1.10.2             │ org.apache.aries.blueprint.core
     72 │ Resolved    │  20 │ 1.0.0              │ org.apache.aries.blueprint.core.compatibility
     73 │ Active      │  30 │ 1.2.0              │ org.apache.aries.jmx.blueprint.api
     74 │ Active      │  30 │ 1.2.0              │ org.apache.aries.jmx.blueprint.core
     78 │ Active      │  50 │ 2.24.1             │ org.apache.camel.camel-blueprint
    117 │ Active      │  30 │ 4.2.7              │ org.apache.karaf.bundle.blueprintstate
    118 │ Active      │  24 │ 4.2.7              │ org.apache.karaf.deployer.blueprint
    120 │ Active      │  30 │ 4.2.7              │ org.apache.karaf.jaas.blueprint.config
    

    这发生在升级 Karaf 之后。

    其他尝试找出正在向哪些处理程序注册的内容。

    karaf@root()> bundle:services -p org.apache.camel.camel-cxf
    
    camel-cxf (80) provides:
    ------------------------
    objectClass = [org.apache.aries.blueprint.NamespaceHandler]
    osgi.service.blueprint.namespace = http://camel.apache.org/schema/blueprint/cxf
    service.bundleid = 80
    service.id = 194
    service.scope = bundle
    ----
    objectClass = [org.osgi.service.blueprint.container.BlueprintContainer]
    osgi.blueprint.container.symbolicname = org.apache.camel.camel-cxf
    osgi.blueprint.container.version = 2.24.1
    service.bundleid = 80
    service.id = 195
    service.scope = singleton
    ----
    objectClass = [org.apache.karaf.shell.commands.info.InfoProvider]
    service.bundleid = 80
    service.id = 196
    service.scope = singleton
    ----
    component = [cxf, cxfbean, cxfrs]
    objectClass = [org.apache.camel.spi.ComponentResolver]
    service.bundleid = 80
    service.id = 197
    service.scope = singleton
    ----
    objectClass = [org.apache.camel.spi.TypeConverterLoader]
    service.bundleid = 80
    service.id = 198
    service.scope = singleton
    

    【讨论】:

      猜你喜欢
      • 2013-02-26
      • 2016-05-17
      • 2018-08-06
      • 2013-08-07
      • 1970-01-01
      • 2021-12-05
      • 1970-01-01
      • 1970-01-01
      • 2014-05-19
      相关资源
      最近更新 更多