我已经反复讨论了这个问题。归结为:
我如何调试在Apache Karaf内部运行的Aries Blueprint?
我最终得到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名称空间。在可以为捆绑软件中使用的每个自定义名称空间找到NamespaceHandler服务之前,蓝图运行时不会解析蓝图xml。除非可以为每个自定义名称空间找到NamespaceHandler服务,否则蓝图容器将无法处理该捆绑包。此结果可能意味着,如果不存在NamespaceHandler,则蓝图容器将无限期等待。如果遇到这种情况,那么蓝图容器会向日志发出警告。当蓝图解析器开始解析蓝图xml文件时,它将解析所有标准蓝图元素。当解析器到达一个自定义元素时,解析器将调用NamespaceHandler,该名称声明为对自定义元素的名称空间的支持。在这里,NamespaceHandler可以处理自定义元素中的信息,修改运行时蓝图模型或执行任何其他操作。如果任何名称空间定义中都有键入错误,那么几乎可以肯定该蓝图无法启动。
这是我最好的答案,但我希望有经验的人能提供更好的答案。
我怀疑另一个蓝图实例可能会对我不利。
[我在Karaf中运行了list -t 0 -s | grep blueprint
,发现有两个不同的blueprint.api
和blueprint.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