1

我正在尝试使用 Mule IDE 使用 Magento 连接器通过 SiteId 和 Sku 获取产品。

这是我的流程:它以 JSON 格式从队列接收参数(SiteId 和 Sku):

 <flow name="flow">
    <amqp:inbound-endpoint queueName="test" responseTimeout="10000" exchange-pattern="request-response" connector-ref="AMQPConnector" doc:name="AMQP-0-9"/>
    <byte-array-to-object-transformer doc:name="Byte Array to Object"/>
    <json:object-to-json-transformer doc:name="Object to JSON"/>
    <set-variable variableName="site" value="#[json:/site]" doc:name="siteVar"/>
    <set-variable variableName="sku" value="#[json:/sku]" doc:name="skuVar"/>
    <logger message="Gettting data from queue #[flowVars.site] and #[flowVars.sku]" level="INFO" doc:name="Logger"/>
    <magento:get-product config-ref="Magento"  doc:name="Magento" storeViewIdOrCode="#[flowVars.site]" productIdOrSku="#[flowVars.sku]"/>
</flow>

异常堆栈是:

  1. 验证表达式为假 (java.lang.IllegalArgumentException) org.apache.commons.lang.Validate:181 (null)
  2. 调用 getProduct 失败。消息负载的类型为:字符串 (org.mule.api.MessagingException) org.mule.devkit.processor.DevkitBasedMessageProcessor:133 ( http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/ api/MessagingException.html )

根异常堆栈跟踪:

java.lang.IllegalArgumentException: The validated expression is false
    at org.apache.commons.lang.Validate.isTrue(Validate.java:181)
    at org.mule.module.magento.api.catalog.AxisMagentoCatalogClient.getProduct(AxisMagentoCatalogClient.java:308)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.mule.module.magento.api.MagentoClientAdaptor$1.invoke(MagentoClientAdaptor.java:52)
    at com.sun.proxy.$Proxy57.getProduct(Unknown Source)
    at org.mule.module.magento.MagentoCloudConnector.getProduct(MagentoCloudConnector.java:1577)
    at org.mule.module.magento.processors.GetProductMessageProcessor$1.process(GetProductMessageProcessor.java:177)
    at org.mule.security.oauth.process.ProcessCallbackProcessInterceptor.execute(ProcessCallbackProcessInterceptor.java:24)
    at org.mule.module.magento.process.MagentoCloudConnectorManagedConnectionProcessInterceptor.execute(MagentoCloudConnectorManagedConnectionProcessInterceptor.java:76)
    at org.mule.module.magento.process.MagentoCloudConnectorManagedConnectionProcessInterceptor.execute(MagentoCloudConnectorManagedConnectionProcessInterceptor.java:23)
    at org.mule.security.oauth.process.RetryProcessInterceptor.execute(RetryProcessInterceptor.java:84)
    at org.mule.module.magento.connectivity.MagentoCloudConnectorManagedConnectionProcessTemplate.execute(MagentoCloudConnectorManagedConnectionProcessTemplate.java:35)
    at org.mule.module.magento.processors.GetProductMessageProcessor.doProcess(GetProductMessageProcessor.java:163)
    at org.mule.devkit.processor.DevkitBasedMessageProcessor.process(DevkitBasedMessageProcessor.java:88)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:85)
    at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:56)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:94)
    at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:56)
    at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:102)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:94)
    at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:56)
    at org.mule.construct.DynamicPipelineMessageProcessor.process(DynamicPipelineMessageProcessor.java:55)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:85)
    at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:56)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:94)
    at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:56)
    at org.mule.interceptor.AbstractEnvelopeInterceptor.processBlocking(AbstractEnvelopeInterceptor.java:58)
    at org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:2...

有什么建议么?

4

1 回答 1

2

源代码显示了这一点:

Validate.isTrue(CollectionUtils.isNotEmpty(attributeNames)
                || CollectionUtils.isNotEmpty(additionalAttributeNames));

这基本上表明该magento:get-product元素至少需要一个magento:attributes-names或一个magento:additional-attribute-names子元素。

请参阅此处的 API 文档:http: //mulesoft.github.io/magento-connector/2.2.0/mule/magento-config.html#get-product

于 2015-11-30T19:58:09.627 回答