这是我的骡子流:
HTTP => 记录器 => SOAP(CXF) =>成功之前[ JAVA ] =>的记录器
春天:
<spring:beans>
<spring:bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<spring:property name="locations">
<spring:list>
<spring:value>test.properties</spring:value>
</spring:list>
</spring:property>
</spring:bean>
<spring:bean id="testIntegration"
class="x.x.x.IntegrationClass" init-method="init">
<spring:property name="url" value="${destiny.url}" />
<spring:property name="username" value="${message.username}" />
<spring:property name="password" value="${message.password}" />
</spring:bean>
</spring:beans>
流速:
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8087" doc:name="HTTP" />
<logger message="#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
<cxf:jaxws-service doc:name="Test service"
serviceClass="dynamics.file.request.Requests" />
<until-successful maxRetries="3"
secondsBetweenRetries="60" doc:name="Until Successful" synchronous="true">
<component doc:name="Java">
<spring-object bean="testIntegration" />
</component>
</until-successful>
<logger message="#[message.payloadAs(java.lang.String)]" level="INFO"
doc:name="Logger" />
</flow>
Java组件返回一个String(XML但是String),当我使用until-successful
时,它显示了这个错误:
Exception thrown inside until-successful org.mule.component.ComponentException: Component that caused exception is: DefaultJavaComponent{Flow_test.component.1805940825}. Message payload is of type: String
[[test_flow].connector.http.mule.default.receiver.02] org.mule.exception.DefaultSystemExceptionStrategy:
********************************************************************************
Message : Failed to find entry point for component, the following resolvers tried but failed: [
MethodHeaderPropertyEntryPointResolver: The required property "method" is not set on the event
CallableEntryPointResolver: Object "es.test.integration.testIntegration@4eb6b10c" does not implement required interface "interface org.mule.api.lifecycle.Callable"
ReflectionEntryPointResolver: Found too many possible methods on object "es.test.integration.testIntegration" that accept parameters "{class java.lang.String}", Methods matched are "[public java.lang.String es.test.integration.testIntegration.cte(java.lang.String), public java.lang.String es.test.integration.testIntegration.cancelCte(java.lang.String), public java.lang.String es.test.integration.testIntegration.newCte(java.lang.String), public java.lang.String es.test.integration.testIntegration.totalCte(java.lang.String), public java.lang.String es.test.integration.testIntegration.resultCte(java.lang.String), public java.lang.String es.test.integration.testIntegration.newCte(java.lang.String), public java.lang.String es.test.integration.testIntegration.cteAll(java.lang.String)]"
AnnotatedEntryPointResolver: Component: es.test.integration.testIntegration@4eb6b10c doesn't have any annotated methods, skipping.
]
Code : MULE_ERROR-321
at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:49)
at org.mule.component.DefaultComponentLifecycleAdapter.invoke(DefaultComponentLifecycleAdapter.java:339)
at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:82)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
Message : Software caused connection abort: socket write error (java.net.SocketException)
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Software caused connection abort: socket write error (java.net.SocketException)
java.net.SocketOutputStream:-2 (null)
2. Software caused connection abort: socket write error (java.net.SocketException) (org.mule.api.DefaultMuleException)
org.mule.transport.http.HttpMessageProcessTemplate:170 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/DefaultMuleException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
有了这个错误,我想我在这里需要任何参数但如果我错了就纠正我:
public void init()
{
NtlmAuthenticator authenticator = new NtlmAuthenticator(username,password);
Authenticator.setDefault(authenticator);
Requestsservice = new Requests();
clntprt = service.getSolicitudesPort();
Client client = ClientProxy.getClient(cliente);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);
BindingProvider provider = (BindingProvider) clntprt;
provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
url);
}
更新
我有init方法,我有实现的方法(例如,这些都有,但还有更多):
@WebMethod(operationName = "CancelCte", action = "urn:microsoft-dynamics-schemas/codeunit/Requests:CancelCte")
@RequestWrapper(localName = "CancelCte", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests", className = "x.x.Requests.CancelCte")
@ResponseWrapper(localName = "CancelCte_Result", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests", className = "x.x.Requests.CancelCteResult")
@WebResult(name = "return_value", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests")
public String CancelCte(
@WebParam(name = "xmlInput", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests") String xmlInput)
{
return client.CancelCte(xmlInput);
}
@WebMethod(operationName = "newCte", action = "urn:microsoft-dynamics-schemas/codeunit/Requests:newCte")
@RequestWrapper(localName = "newCte", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests", className = "x.x.Requests.newCte")
@ResponseWrapper(localName = "newCte_Result", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests", className = "x.x.Requests.newCteResult")
@WebResult(name = "return_value", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests")
public String newCte(
@WebParam(name = "xmlInput", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests") String xmlInput)
{
return client.newCte(xmlInput);
}
像现在一样,自动使用必要的方法。
答案 0 :(得分:1)
根据您提供的部分信息,我只能说问题的根源在于:
<spring-object bean="testIntegration" />
基于:Component that caused exception is: DefaultJavaComponent{Flow_test.component.1805940825}
主要问题是Mule无法找到调用自定义组件的方法:有两种方法可以使用String
,这可以防止Mule选择合适的&#34 ;切入点&#34;。解决此问题的两种解决方案:
method
的属性作为其值,invoke
消息处理器直接调用所需的方法。作为旁注,似乎此组件执行出站HTTP调用:通常您希望使用Mule HTTP来执行此操作,而不是在自定义代码中执行此操作。首先,您将这些交互隐藏在自定义代码中:查看Mule配置的人不知道涉及到出站HTTP呼叫。此外,Mule本身不会知道,因此无法对这些自定义HTTP调用执行诸如一般生命周期和错误管理,统计信息等任何操作。