Исключение Mule: обязательный объект / свойство muleContext имеет значение null

Я получаю вышеуказанную ошибку при извлечении значений из базы данных. Что такое значение muleContext, если я хочу установить его?Ниже приведен мой конфигурационный xml

<?xml version="1.0" encoding="UTF-8"?>

<mule          
 

xsi_schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/x12-edi http://www.mulesoft.org/schema/mule/x12-edi/current/mule-x12-edi.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/batch http://www.mulesoft.org/schema/mule/batch/current/mule-batch.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-current.xsd">
<x12-edi:config name="X12_EDI_files" doc_name="X12 EDI">
<x12-edi:schemas>
<x12-edi:schema>/x12/005010/850.esl</x12-edi:schema>
</x12-edi:schemas>
</x12-edi:config>
<context:property-placeholder location="DBConnection.properties"/>
<db:mysql-config name="MySQL_Configuration_Insert" host="${db.host}" port="${db.port}" user="${db.username}" password="${db.password}" database="${db.database}" doc_name="MySQL Configuration"/>
<flow name="edi_retailFlow">
<file:inbound-endpoint path="src/main/resources/input" moveToPattern="#[message.inboundProperties.originalFilename]_archive.edi" moveToDirectory="src/main/resources/output" responseTimeout="10000" doc_name="Read File"/>
<x12-edi:read config-ref="X12_EDI_files" doc_name="Reads X12 EDI message"/>
<enricher target="#[flowVars.batchResult]" doc_name="Message Enricher">
<choice doc_name="Choice">
<when expression="#[message.inboundProperties.originalFilename contains 810]">
<batch:execute name="Process_810_Batch" doc_name="Process_810_Batch"/>
</when>
<when expression="#[message.inboundProperties.originalFilename contains 850]">
<batch:execute name="Process_850_Batch" doc_name="Process_850_Batch"/>
</when>
</choice>
</enricher>
<flow-ref name="Send_Ack" doc_name="Send_Ack"/>
</flow>
<flow name="Send_Ack">
<dw:transform-message doc_name="Transform 997 Ack">
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
{
TransactionSets: {
v005010: {
"997": payload.FunctionalAcksGenerated
}
}
}]]></dw:set-payload>
</dw:transform-message>
<x12-edi:write config-ref="X12_EDI_files" doc_name="X12 EDI">
<x12-edi:map ref="#[payload]"/>
</x12-edi:write>
<file:outbound-endpoint path="src/main/resources/output" outputPattern="#[message.inboundProperties.originalFilename]_997.edi" responseTimeout="10000" doc_name="File"/>
</flow>
<batch:job name="Process_850_Batch">
<batch:input>
<dw:transform-message metadata_id="973d0231-b863-428a-8414-eb6a2d69b15b" doc_name="Process 850">
<dw:input-payload mimeType="application/java"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
payload.TransactionSets.v005010."850"]]></dw:set-payload>
</dw:transform-message>
</batch:input>
<batch:process-records>
<batch:step name="Batch_Step">
<dw:transform-message metadata_id="e7c299fd-8246-4cca-9466-9f81db4a8498" doc_name="Object to Json">
<dw:input-payload doc_sample="sample_datamap_2.dwl"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
{
purchaseOrder: {
purchaseOrderNumber: payload.Heading."0200_BEG".BEG03,
transactionCode: payload.Heading."0200_BEG".BEG01,
transactionTypeCode: payload.Heading."0200_BEG".BEG02,
dateTime: payload.Heading."0200_BEG".BEG05 as :string,
currency: payload.Heading."0400_CUR".CUR02,
buyerDetailspayload.Heading."3100_N1_Loop" map ((v3100Loop,indexOfv3100Loop) -> {
billToName: v3100Loop."3100_N1".N102,
(btn_contact: v3100Loop."3600_PER"[0].PER04) when v3100Loop."3600_PER"[0].PER03=='TE',
btn_address: v3100Loop."3300_N3"[0].N301
} when v3100Loop."3100_N1".N101 =='BT' otherwise '')),
shipperDetailspayload.Heading."3100_N1_Loop" map ((v3100Loop,indexOfv3100Loop) -> {
shipToName: v3100Loop."3100_N1".N102,
(stn_contact: v3100Loop."3600_PER"[0].PER04) when v3100Loop."3600_PER"[0].PER03=='TE',
stn_address: v3100Loop."3300_N3"[0].N301
} when v3100Loop."3100_N1".N101 =='ST' otherwise '')),
productDetails: (payload.Detail."0100_PO1_Loop" map ((v0100Loop, indexOfv0100Loop) -> {
productName: v0100Loop."0500_PID_Loop"[0]."0500_PID".PID05, 
quantity: v0100Loop."0100_PO1".PO102,
price: v0100Loop."0100_PO1".PO104 as :string
}))
}
}]]></dw:set-payload>
</dw:transform-message>
<dw:transform-message metadata_id="69ab44ca-d9c5-4436-9093-77fca72a7dd7" doc_name="Trim Null">
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
{
purchaseOrder: {
purchaseOrderNumber: payload.purchaseOrder.purchaseOrderNumber,
transactionCode: payload.purchaseOrder.transactionCode,
transactionTypeCode: payload.purchaseOrder.transactionTypeCode,
dateTime: payload.purchaseOrder.dateTime,
currency: payload.purchaseOrder.currency,
(buyerDetails: {
billToName: payload.purchaseOrder.buyerDetails.billToName,
btn_contact: payload.purchaseOrder.buyerDetails.btn_contact,
btn_address: payload.purchaseOrder.buyerDetails.btn_address
}) when payload.purchaseOrder.buyerDetails.billToName !='',
(shipperDetails: {
shipToName: payload.purchaseOrder.shipperDetails.shipToName,
stn_contact: payload.purchaseOrder.shipperDetails.stn_contact,
stn_address: payload.purchaseOrder.shipperDetails.stn_address
}) when payload.purchaseOrder.shipperDetails.shipToName !='',
productDetailspayload.purchaseOrder.productDetails map ((vprod, indexOfvprod) -> {
productName: vprod.productName,
quantity: vprod.quantity,
price: vprod.price
}))
}
}]]></dw:set-payload>
</dw:transform-message>
<logger message="#[message.payloadAs(java.lang.String)]" level="INFO" doc_name="Logger"/>
<dw:transform-message doc_name="Json to Object">
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
payload]]></dw:set-payload>
</dw:transform-message>
<set-variable variableName="InputPayload" value="#[payload]" doc_name="Variable"/>
<db:insert config-ref="MySQL_Configuration_Insert" doc_name="Insert in Buyer_Table">
<db:parameterized-query><![CDATA[insert into Buyer_Table (billtoname, btn_contact, btn_address, shiptoname, stn_contact, stn_address) values (#[flowVars.InputPayload.purchaseOrder.buyerDetails.billToName], #[flowVars.InputPayload.purchaseOrder.buyerDetails.btn_contact],#[flowVars.InputPayload.purchaseOrder.buyerDetails.btn_address],#[flowVars.InputPayload.purchaseOrder.shipperDetails.shipToName],#[flowVars.InputPayload.purchaseOrder.shipperDetails.stn_contact], #[flowVars.InputPayload.purchaseOrder.shipperDetails.stn_address]);]]></db:parameterized-query>

</db:insert>
<db:select config-ref="MySQL_Configuration_Insert" doc_name="Get buyer_id">
<db:parameterized-query><![CDATA[SELECT buyer_id FROM Buyer_Table WHERE buyer_id = (SELECT MAbuyer_id) FROM Buyer_Table);]]></db:parameterized-query>
</db:select>
<db:insert config-ref="MySQL_Configuration_Insert" doc_name="Insert in PO_Table">
<db:parameterized-query><![CDATA[insert into PO_Table (buyer_id,purchaseorder_no,transaction_type,transaction_code,date_time,currency) 
values (#[payload[0].buyer_id],#[flowVars.InputPayload.purchaseOrder.purchaseOrderNumber], #[flowVars.InputPayload.purchaseOrder.transactionTypeCode],#[flowVars.InputPayload.purchaseOrder.transactionCode],#[flowVars.InputPayload.purchaseOrder.dateTime],#[flowVars.InputPayload.purchaseOrder.currency]);]]></db:parameterized-query>
</db:insert>
<db:select config-ref="MySQL_Configuration_Insert" doc_name="Get po_no">
<db:parameterized-query><![CDATA[SELECT po_no FROM PO_Table WHERE po_no = (SELECT MApo_no) FROM PO_Table);]]></db:parameterized-query>
</db:select>

<db:insert config-ref="MySQL_Configuration_Insert" bulkMode="true" doc_name="Insert in Product_Table">
<db:parameterized-query><![CDATA[insert into Product_Table (po_no,product_name,quantity,unit_price) values (#[payload[0].po_no],#[flowVars.InputPayload.purchaseOrder.productDetails.productName],#[flowVars.InputPayload.purchaseOrder.productDetails.quantity],#[flowVars.InputPayload.purchaseOrder.productDetails.price]);]]></db:parameterized-query>

</db:insert>
<logger message="#[payload]" level="INFO" doc_name="Logger"/>
</batch:step>
</batch:process-records>
<batch:on-complete>
<logger message="#[message.payloadAs(java.lang.String)]" level="INFO" doc_name="Logger"/>
</batch:on-complete>
</batch:job>
<batch:job name="Process_810_Batch">
<batch:input>
<dw:transform-message metadata_id="6d57575e-bbca-46ca-88f8-565f438dcf79" doc_name="Transform Message">
<dw:input-payload mimeType="application/java"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
payload.TransactionSets.v005010."810"]]></dw:set-payload>
</dw:transform-message>
</batch:input>
<batch:process-records>
<batch:step name="Batch_Step1">
<logger message="&quot;In 810&quot;" level="INFO" doc_name="Logger"/>
</batch:step>
</batch:process-records>
<batch:on-complete>
<logger message="&quot;Batch 810 complete&quot;" level="INFO" doc_name="Logger"/>
</batch:on-complete>
</batch:job>
</mule>

Я думал, что muleContext автоматически передается, но для этой ошибки, Как установить mulecontext свойство?

1 ответ

  1. Вы уверены, что у вас есть эта ошибка? У меня разные для вашего xml файла. На самом деле это синтаксическая ошибка. И я не вижу места, где вы пытаетесь использовать muleContext в предоставленном источнике:

    Введите описание изображения здесь