我正在使用Mule IDE尝试SiteId和Sku使用Magento连接器获取GetProduct。
这是我的流程: 它以JSON格式从队列接收params(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>
异常堆栈是:
Root异常堆栈跟踪:
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...
任何建议?
答案 0 :(得分:2)
source code显示了这一点:
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