在下面的mule流程中,我实现了带有VMendpoint的REST web服务的Jersey类。
<flow name="APIKeyLoadFlow" doc:name="APIKeyLoadFlow"
initialState="started">
<http:inbound-endpoint exchange-pattern="request-response"
address="${api.load.invoke.url}" doc:name="HTTP"
responseTimeout="${apikey.http.responsetimeout}" />
<logger message="Start Of APIKeyLoadFlow -#[payload]" level="INFO"
doc:name="ENTRY_LOG" />
<request-reply timeout="300000" >
<vm:outbound-endpoint connector-ref="VM_Connector"
exchange-pattern="one-way" path="APIKeyLoadRequest">
</vm:outbound-endpoint>
<vm:inbound-endpoint connector-ref="VM_Connector"
exchange-pattern="one-way" path="APIKeyLoadResponse">
</vm:inbound-endpoint>
</request-reply>
<logger message="End of APIKeyLoadFlow" level="INFO" doc:name="EXIT_LOG" />
<catch-exception-strategy doc:name="Catch Exception Strategy">
<logger level="WARN" doc:name="Exception_Log"
message="Exception in ApiKeyFlow #[System.getProperty('line.separator')] Error Description = #[exception.getMessage()]" />
</catch-exception-strategy>
</flow>
<flow name="ApiKeyLoadRestServiceFlow" doc:name="ApiKeyLoadRestServiceFlow">
<vm:inbound-endpoint exchange-pattern="one-way"
path="APIKeyLoadRequest" doc:name="APIKey_Load_Request">
</vm:inbound-endpoint>
<logger message="Start of ApiKeyLoadRestServiceFlow -#[payload]" level="INFO"
doc:name="ENTRY_LOG" />
<jersey:resources doc:name="REST">
<component class="com.elexon.bmrs.apikey.service.impl.ApiKeyLoadImpl" />
</jersey:resources>
<logger message="End of ApiKeyLoadRestServiceFlow" level="INFO"
doc:name="EXIT_LOG" />
<vm:outbound-endpoint exchange-pattern="one-way"
path="APIKeyLoadResponse" doc:name="APIKey_Load_Response">
</vm:outbound-endpoint>
但是我在运行请求时遇到了以下异常?请告诉我实施流程中的问题是什么?
信息2015-12-08 13:09:59792[[apikey_load_phase3].connecter.http.mule.default.receptor.02]org.mule.api.prrocessor.LoggerMessage processor:APIKeyLoadFlow的开始-org.apache.commons.httpclient.ContentLengthInputStream@1517f14信息2015-12-08 13:09:59813[[apikey_load_phase3].connecter.http.mule.default.eccepter.02]org.mule.lifecycle.AbstractLifecycleManager:初始化:'VM_Connecter.dispatcher.25489136'。对象为:VMMessageDispatcher信息2015-12-09 13:09:59813[[apikey-load_phase3].connecter.http://mule.default.ecceptr.02]org.mule.lifecycle.AbtractLifecycleNanager:启动:“VM_Connector.dispatcher.25489136”。对象为:VMMessageDispatcher INFO 2015-12-08 13:09:59830[[apikey_load_phase3].ApiKeyLoadRestServiceFlow.sstage1.02]org.mule.api.prrocessor.LoggerMessage processor:ApiKeyLoadRestService Flow的开始-org.apache.commons.httpclient.ContentLengthInputStream@1517f14错误2015-12-08 13:09:59833[[apikey_load_phase3].ApiKeyLoadRestServiceFlow.sstage1.02]org.mule.exception.DefaultMessagingException策略:
消息:未能调用JerseyResourcesComponent{ApiKeyLoadRestServiceFlow.component.14630019}。导致异常的组件为:JerseyresourcesComponente{ApiFeyLoadRestServiceFlow.component.14630019}。消息负载的类型为:ContentLengthInputStream
异常堆栈为:1。null(Java . lang . nullpointerexception)org . mule . module . jersey . jersey resources component:116(null)2。未能调用JerseyResourcesComponent { apikeyloadrestserviceflow . component . 14630019 }。导致异常的组件是:JerseyResourcesComponent { apikeyloadrestserviceflow . component . 14630019 }。消息负载的类型为:contentlength inputstream(org . mule . component . component exception)
根异常堆栈跟踪:org.mule.module.jersy.JerseyResourcesComponent.doInvoke(JerseyresourcesComponend.java:116),org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:122),位于org.mule.component.Abstract component.access$000(Abstract component.java:57),还有3个(设置调试级别日志记录或“-Dmule.verbose.exceptions=true”用于所有内容)
Jersey组件需要绑定到httpendpoint,因此不确定它是否可以在VMendpoint后面工作,因为在通过传输屏障等时,所有http标头和请求信息都将丢失。您可以尝试在VM调用之前将标头从入站复制到出站,但仍不确定这是否可行。