CamelContext(wsBlueprintContext) 由于已经是目的地
CamelContext(wsBlueprintContext) due Already a destination on
当我尝试启动我的 osgi 包时,它因错误而失败...
14:06:46,086 | ERROR | l Console Thread | BlueprintCamelContext | 234 - org.apache.camel.camel-blueprint - 2.17.0.redhat-630187 | Error occurred during starting Camel: CamelContext(wsBlueprintContext) due Already a destination on http://hostDomainName:80/cxf/sentence java.lang.RuntimeException: Already a destination on http://hostDomainName:80/cxf/sentence
at org.apache.cxf.transport.http.DestinationRegistryImpl.addDestination(DestinationRegistryImpl.java:50)
这是蓝图 xml 文件中的代码片段...
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd">
<camelcxf:cxfEndpoint id="sentenceEndpoint"
loggingFeatureEnabled="true" address="{{sentenceHttpAddress}}"
serviceClass="gov.mcjn.it.sentence.ws._interface._1_0.SentenceInterface">
<camelcxf:features>
<wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing" />
</camelcxf:features>
</camelcxf:cxfEndpoint>
<camelcxf:cxfEndpoint id="sentenceResponseEndpoint"
loggingFeatureEnabled="true" address="{{sentenceResponseHttpAddress}}"
serviceClass="gov.ojp.it.commonresponse._1_0.ws.receivingagency.ResponseInterface">
<camelcxf:features>
<wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing" />
</camelcxf:features>
</camelcxf:cxfEndpoint>
<camelContext trace="true" id="wsBlueprintContext"
xmlns="http://camel.apache.org/schema/blueprint">
<route id="cxfSentenceService">
<from uri="cxf:bean:sentenceEndpoint" />
<removeHeaders pattern="Expect" />
<inOnly uri="activemq:incomingSentence?jmsMessageType=Object" />
<bean ref="sentenceResponseProcessor" />
</route>
<route id="cxfSentenceResponseService">
<from uri="cxf:bean:sentenceResponseEndpoint" />
<removeHeaders pattern="Expect" />
<inOnly
uri="activemq:incomingSentenceResponse?jmsMessageType=Object" />
<process ref="sentenceAsyncResponseProcessor" />
</route>
此片段来自我的属性文件...
sentenceResponseHttpAddress=http://hostDomainName/cxf/sentence/response
sentenceHttpAddress=http://hostDomainName/cxf/sentence
CXF 似乎认为我两次使用同一个端点,但我不同意。这些端点在 Fusesource ESB v1 中运行良好。我正在尝试将它们迁移到 JBoss Fuse 6.3。为了简化测试和部署,我首先部署到一个独立的karaf容器,所以Fabric(fabric8)还没有应用。
更新:我尝试更改 <camelcxf:cxfEndpoint> to <jaxws:client>
但这导致了不同的错误。在那个新错误中,camel 期待 CxfEndpoint 类型,但却得到了一个 Proxy 对象。我真的不想更改端点来解决此问题。我确定我还没有找到使用相同端点的两个地方。仍在寻找那个。
更新:我已经确认 URI 地址没有被使用两次。现在看来我的整个 <camelContext>
被加载了不止一次,即使我只在存储库中配置了一个 osgi 功能来使用 osgi 包。
我通过在 camelContext 上放置一个唯一 ID 并查看该 ID 的日志来发现问题。较早的错误 [java.nio.channels.UnresolvedAddressException] 导致 camel 上下文关闭然后重新启动。在重新启动期间,它会尝试重新加载,而之前的加载仍在内存中。
故事的寓意:
在您的 cfg 文件中获取正确的 属性 值,因为无法在 DNS 中解析的主机名将导致您的 camel 上下文关闭,然后重新启动并显示误导性错误消息。
更好的是,只使用相对端点而不是完全限定的端点。
当我尝试启动我的 osgi 包时,它因错误而失败...
14:06:46,086 | ERROR | l Console Thread | BlueprintCamelContext | 234 - org.apache.camel.camel-blueprint - 2.17.0.redhat-630187 | Error occurred during starting Camel: CamelContext(wsBlueprintContext) due Already a destination on http://hostDomainName:80/cxf/sentence java.lang.RuntimeException: Already a destination on http://hostDomainName:80/cxf/sentence
at org.apache.cxf.transport.http.DestinationRegistryImpl.addDestination(DestinationRegistryImpl.java:50)
这是蓝图 xml 文件中的代码片段...
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd">
<camelcxf:cxfEndpoint id="sentenceEndpoint"
loggingFeatureEnabled="true" address="{{sentenceHttpAddress}}"
serviceClass="gov.mcjn.it.sentence.ws._interface._1_0.SentenceInterface">
<camelcxf:features>
<wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing" />
</camelcxf:features>
</camelcxf:cxfEndpoint>
<camelcxf:cxfEndpoint id="sentenceResponseEndpoint"
loggingFeatureEnabled="true" address="{{sentenceResponseHttpAddress}}"
serviceClass="gov.ojp.it.commonresponse._1_0.ws.receivingagency.ResponseInterface">
<camelcxf:features>
<wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing" />
</camelcxf:features>
</camelcxf:cxfEndpoint>
<camelContext trace="true" id="wsBlueprintContext"
xmlns="http://camel.apache.org/schema/blueprint">
<route id="cxfSentenceService">
<from uri="cxf:bean:sentenceEndpoint" />
<removeHeaders pattern="Expect" />
<inOnly uri="activemq:incomingSentence?jmsMessageType=Object" />
<bean ref="sentenceResponseProcessor" />
</route>
<route id="cxfSentenceResponseService">
<from uri="cxf:bean:sentenceResponseEndpoint" />
<removeHeaders pattern="Expect" />
<inOnly
uri="activemq:incomingSentenceResponse?jmsMessageType=Object" />
<process ref="sentenceAsyncResponseProcessor" />
</route>
此片段来自我的属性文件...
sentenceResponseHttpAddress=http://hostDomainName/cxf/sentence/response
sentenceHttpAddress=http://hostDomainName/cxf/sentence
CXF 似乎认为我两次使用同一个端点,但我不同意。这些端点在 Fusesource ESB v1 中运行良好。我正在尝试将它们迁移到 JBoss Fuse 6.3。为了简化测试和部署,我首先部署到一个独立的karaf容器,所以Fabric(fabric8)还没有应用。
更新:我尝试更改 <camelcxf:cxfEndpoint> to <jaxws:client>
但这导致了不同的错误。在那个新错误中,camel 期待 CxfEndpoint 类型,但却得到了一个 Proxy 对象。我真的不想更改端点来解决此问题。我确定我还没有找到使用相同端点的两个地方。仍在寻找那个。
更新:我已经确认 URI 地址没有被使用两次。现在看来我的整个 <camelContext>
被加载了不止一次,即使我只在存储库中配置了一个 osgi 功能来使用 osgi 包。
我通过在 camelContext 上放置一个唯一 ID 并查看该 ID 的日志来发现问题。较早的错误 [java.nio.channels.UnresolvedAddressException] 导致 camel 上下文关闭然后重新启动。在重新启动期间,它会尝试重新加载,而之前的加载仍在内存中。
故事的寓意: 在您的 cfg 文件中获取正确的 属性 值,因为无法在 DNS 中解析的主机名将导致您的 camel 上下文关闭,然后重新启动并显示误导性错误消息。
更好的是,只使用相对端点而不是完全限定的端点。