2

I'm trying to validate xml payload with XSD, where this XSD is referring other and the other is referring someother. Something like nested reference.

When I include all the .xsd's in Validate Schema path, I still get:

Root Exception stack trace: org.xml.sax.SAXParseException; schema_reference: Failed to read schema document 'MPProduct.xsd', because 'file' access is not allowed due to restriction set by the accessExternalSchema property. om.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:306) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4160) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaFatalError(XSDHandler.java:4135) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2172) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.resolveSchema(XSDHandler.java:2100) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:1104) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:623) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:613) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:572) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:538) at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:255) at org.mule.module.xml.internal.operation.SchemaValidatorOperation$2.create(SchemaValidatorOperation.java:142) at org.mule.module.xml.internal.operation.SchemaValidatorOperation$2.create(SchemaValidatorOperation.java:132) at org.apache.commons.pool2.BasePooledObjectFactory.makeObject(BasePooledObjectFactory.java:58) at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:888) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:432)

Any suggestions to resolve this please?

I tried adding -Djavax.xml.accessExternalSchema=all in VM arguments while running on local still it remains same

<flow name="mytestingFlow" doc:id="4efe5074-da20-4164-843a-06ca9a2a9979" >
        <http:listener doc:name="Listener" doc:id="74f4f199-00cb-460d-b72f-df3497f26e6a" config-ref="HTTP_Listener_config" path="/service/path/one"/>
        <set-payload value="#[&quot;&lt;MPItemFeed xmlns=\&quot;http://walmart.com/\&quot;&gt;&lt;MPItemFeedHeader&gt;&lt;version&gt;3.2&lt;/version&gt;&lt;/MPItemFeedHeader&gt;&lt;MPItem&gt;&lt;processMode&gt;CREATE&lt;/processMode&gt;&lt;sku&gt;10145802&lt;/sku&gt;&lt;productIdentifiers&gt;&lt;productIdentifier&gt;&lt;productIdType&gt;UPC&lt;/productIdType&gt;&lt;productId&gt;123456789123&lt;/productId&gt;&lt;/productIdentifier&gt;&lt;/productIdentifiers&gt;&lt;MPProduct&gt;&lt;SkuUpdate&gt;NO&lt;/SkuUpdate&gt;&lt;msrp&gt;183.99&lt;/msrp&gt;&lt;productName&gt;CARQUEST Platinum Professional Ceramic Brake Pads - Front (4-Pad Set)&lt;/productName&gt;&lt;ProductIdUpdate&gt;YES&lt;/ProductIdUpdate&gt;&lt;category&gt;&lt;Vehicle&gt;&lt;VehiclePartsAndAccessories&gt;&lt;shortDescription&gt;Ceramic Brake Pads - Front (4-Pad Set)&lt;/shortDescription&gt;&lt;keyFeatures&gt;&lt;keyFeaturesValue&gt;Premium brake pad underlayer reduces vibration for silent braking Industry leading number of application specific formulations for maximum performance Revolutionary burnishing compound strip allows for proper break-in of pads and rotors.&lt;/keyFeaturesValue&gt;&lt;/keyFeatures&gt;&lt;brand&gt;CARQUEST Platinum Professional&lt;/brand&gt;&lt;manufacturer&gt;CARQUEST Platinum Professional&lt;/manufacturer&gt;&lt;manufacturerPartNumber&gt;PXD1210H&lt;/manufacturerPartNumber&gt;&lt;mainImageUrl&gt;http://pdfifsvcprd.corp.advancestores.com/assets/epc50x50/std.lang.all/1012147531.jpg&lt;/mainImageUrl&gt;&lt;isProp65WarningRequired&gt;Yes&lt;/isProp65WarningRequired&gt;&lt;prop65WarningText&gt;cancer and reproductive&lt;/prop65WarningText&gt;&lt;hasWarranty&gt;YES&lt;/hasWarranty&gt;&lt;warrantyText&gt;LIMITED LIFETIME REPLACEMENT&lt;/warrantyText&gt;&lt;/VehiclePartsAndAccessories&gt;&lt;/Vehicle&gt;&lt;/category&gt;&lt;/MPProduct&gt;&lt;MPOffer&gt;&lt;price&gt;182.99&lt;/price&gt;&lt;ShippingWeight&gt;&lt;measure&gt;4&lt;/measure&gt;&lt;unit&gt;lb&lt;/unit&gt;&lt;/ShippingWeight&gt;&lt;ProductTaxCode&gt;2038710&lt;/ProductTaxCode&gt;&lt;/MPOffer&gt;&lt;/MPItem&gt;&lt;MPItem&gt;&lt;processMode&gt;CREATE&lt;/processMode&gt;&lt;sku&gt;11395545&lt;/sku&gt;&lt;productIdentifiers&gt;&lt;productIdentifier&gt;&lt;productIdType&gt;UPC&lt;/productIdType&gt;&lt;productId&gt;123456789123&lt;/productId&gt;&lt;/productIdentifier&gt;&lt;/productIdentifiers&gt;&lt;MPProduct&gt;&lt;SkuUpdate&gt;NO&lt;/SkuUpdate&gt;&lt;msrp&gt;183.99&lt;/msrp&gt;&lt;productName&gt;CARQUEST Platinum Brake Rotor - Front&lt;/productName&gt;&lt;ProductIdUpdate&gt;YES&lt;/ProductIdUpdate&gt;&lt;category&gt;&lt;Vehicle&gt;&lt;VehiclePartsAndAccessories&gt;&lt;shortDescription&gt;Brake Rotor - Front&lt;/shortDescription&gt;&lt;keyFeatures&gt;&lt;keyFeaturesValue&gt;Engineered to withstand 120 hours of salt spray testing Manufactured to exacting quality and dimensional specifications for Superior Stopping Power Exceeds ISO manufacturing guidelines (International Organization for Standardization)&lt;/keyFeaturesValue&gt;&lt;/keyFeatures&gt;&lt;brand&gt;CARQUEST Platinum&lt;/brand&gt;&lt;manufacturer&gt;CARQUEST Platinum&lt;/manufacturer&gt;&lt;manufacturerPartNumber&gt;YH145232P&lt;/manufacturerPartNumber&gt;&lt;mainImageUrl&gt;http://pdfifsvcprd.corp.advancestores.com/assets/epc50x50/std.lang.all/1017931756.jpg&lt;/mainImageUrl&gt;&lt;isProp65WarningRequired&gt;No&lt;/isProp65WarningRequired&gt;&lt;prop65WarningText/&gt;&lt;hasWarranty&gt;YES&lt;/hasWarranty&gt;&lt;warrantyText&gt;2 YR REPLACEMENT IF DEFECTIVE&lt;/warrantyText&gt;&lt;/VehiclePartsAndAccessories&gt;&lt;/Vehicle&gt;&lt;/category&gt;&lt;/MPProduct&gt;&lt;MPOffer&gt;&lt;price&gt;182.99&lt;/price&gt;&lt;ShippingWeight&gt;&lt;measure&gt;4&lt;/measure&gt;&lt;unit&gt;lb&lt;/unit&gt;&lt;/ShippingWeight&gt;&lt;ProductTaxCode&gt;2038710&lt;/ProductTaxCode&gt;&lt;/MPOffer&gt;&lt;/MPItem&gt;&lt;MPItem&gt;&lt;processMode&gt;CREATE&lt;/processMode&gt;&lt;sku&gt;10556036&lt;/sku&gt;&lt;productIdentifiers&gt;&lt;productIdentifier&gt;&lt;productIdType&gt;UPC&lt;/productIdType&gt;&lt;productId&gt;123456789123&lt;/productId&gt;&lt;/productIdentifier&gt;&lt;/productIdentifiers&gt;&lt;MPProduct&gt;&lt;SkuUpdate&gt;NO&lt;/SkuUpdate&gt;&lt;msrp&gt;183.99&lt;/msrp&gt;&lt;productName&gt;CARQUEST Premium Lube Element with Lid&lt;/productName&gt;&lt;ProductIdUpdate&gt;YES&lt;/ProductIdUpdate&gt;&lt;category&gt;&lt;Vehicle&gt;&lt;VehiclePartsAndAccessories&gt;&lt;shortDescription&gt;Lube Element with Lid&lt;/shortDescription&gt;&lt;keyFeatures&gt;&lt;keyFeaturesValue&gt;Environmental cartridge lube filter High efficiency and durable cellulose/synthetic blended media for longer drain intervals Silicone anti-drain back valve has 3X the durability verses nitrile for engine start-up protection&lt;/keyFeaturesValue&gt;&lt;/keyFeatures&gt;&lt;brand&gt;CARQUEST Premium&lt;/brand&gt;&lt;manufacturer&gt;CARQUEST Premium&lt;/manufacturer&gt;&lt;manufacturerPartNumber&gt;84312&lt;/manufacturerPartNumber&gt;&lt;mainImageUrl&gt;http://pdfifsvcprd.corp.advancestores.com/assets/epc50x50/std.lang.all/1015772990.jpg&lt;/mainImageUrl&gt;&lt;isProp65WarningRequired&gt;Yes&lt;/isProp65WarningRequired&gt;&lt;prop65WarningText&gt;cancer and reproductive&lt;/prop65WarningText&gt;&lt;hasWarranty&gt;YES&lt;/hasWarranty&gt;&lt;warrantyText&gt;REPLACE OR REFUND AT MGR DISCRETION&lt;/warrantyText&gt;&lt;/VehiclePartsAndAccessories&gt;&lt;/Vehicle&gt;&lt;/category&gt;&lt;/MPProduct&gt;&lt;MPOffer&gt;&lt;price&gt;182.99&lt;/price&gt;&lt;ShippingWeight&gt;&lt;measure&gt;4&lt;/measure&gt;&lt;unit&gt;lb&lt;/unit&gt;&lt;/ShippingWeight&gt;&lt;ProductTaxCode&gt;2038710&lt;/ProductTaxCode&gt;&lt;/MPOffer&gt;&lt;/MPItem&gt;&lt;MPItem&gt;&lt;processMode&gt;CREATE&lt;/processMode&gt;&lt;sku&gt;20471798&lt;/sku&gt;&lt;productIdentifiers&gt;&lt;productIdentifier&gt;&lt;productIdType&gt;UPC&lt;/productIdType&gt;&lt;productId&gt;123456789123&lt;/productId&gt;&lt;/productIdentifier&gt;&lt;/productIdentifiers&gt;&lt;MPProduct&gt;&lt;SkuUpdate&gt;NO&lt;/SkuUpdate&gt;&lt;msrp&gt;183.99&lt;/msrp&gt;&lt;productName&gt;Denso Air-Fuel Ratio Sensor 4 Wire, Direct Fit, Heated, Wire Length: 10.63&lt;/productName&gt;&lt;ProductIdUpdate&gt;YES&lt;/ProductIdUpdate&gt;&lt;category&gt;&lt;Vehicle&gt;&lt;VehiclePartsAndAccessories&gt;&lt;shortDescription&gt;Air-Fuel Ratio Sensor 4 Wire, Direct Fit, Heated, Wire Length: 10.63&lt;/shortDescription&gt;&lt;keyFeatures&gt;&lt;keyFeaturesValue&gt;Specifically designed to meet the increasing demands of today's engines 100% checked for high temperature signal output, air tightness, continuity, and heat resistance for optimal efficiency and performance Double protection cover helps maintain proper unit temperature for quicker response times, which is critical to your vehicle's fuel efficiency&lt;/keyFeaturesValue&gt;&lt;/keyFeatures&gt;&lt;brand&gt;Denso&lt;/brand&gt;&lt;manufacturer&gt;Denso&lt;/manufacturer&gt;&lt;manufacturerPartNumber&gt;234-9001&lt;/manufacturerPartNumber&gt;&lt;mainImageUrl&gt;http://pdfifsvcprd.corp.advancestores.com/assets/epc50x50/std.lang.all/524891.jpg&lt;/mainImageUrl&gt;&lt;isProp65WarningRequired&gt;No&lt;/isProp65WarningRequired&gt;&lt;prop65WarningText/&gt;&lt;hasWarranty&gt;YES&lt;/hasWarranty&gt;&lt;warrantyText&gt;1 YR REPLACEMENT IF DEFECTIVE&lt;/warrantyText&gt;&lt;/VehiclePartsAndAccessories&gt;&lt;/Vehicle&gt;&lt;/category&gt;&lt;/MPProduct&gt;&lt;MPOffer&gt;&lt;price&gt;182.99&lt;/price&gt;&lt;ShippingWeight&gt;&lt;measure&gt;4&lt;/measure&gt;&lt;unit&gt;lb&lt;/unit&gt;&lt;/ShippingWeight&gt;&lt;ProductTaxCode&gt;2038710&lt;/ProductTaxCode&gt;&lt;/MPOffer&gt;&lt;/MPItem&gt;&lt;/MPItemFeed&gt;
&quot;]" doc:name="Set Payload" doc:id="b16a5f07-fa58-4c36-837a-3533eecdcccd" mimeType="application/xml"/>
        <ee:transform doc:name="Transform Message" doc:id="a6d22ddb-1e3a-4519-a22f-41987f9b5049" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/xml  
---
payload]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <xml-module:validate-schema doc:name="Validate schema" doc:id="c5dbaef9-d4f3-4aeb-b15a-516aa0eb2479" schemas="Animal.xsd,ArtAndCraftCategory.xsd,Baby.xsd,CarriersAndAccessoriesCategory.xsd,ClothingCategory.xsd,Electronics.xsd,FoodAndBeverageCategory.xsd,FootwearCategory.xsd,FurnitureCategory.xsd,GardenAndPatioCategory.xsd,HealthAndBeauty.xsd,Home.xsd,JewelryCategory.xsd,Media.xsd,MPCommons.xsd,MPItem.xsd,MPItemFeed.xsd,MPItemFeedHeader.xsd,MPOffer.xsd,MPProduct.xsd,MusicalInstrument.xsd,OccasionAndSeasonal.xsd,OfficeCategory.xsd,OtherCategory.xsd,Photography.xsd,SportAndRecreation.xsd,ToolsAndHardware.xsd,ToysCategory.xsd,Vehicle.xsd,WatchesCategory.xsd" config-ref="XML_Config"/>
        <logger level="INFO" doc:name="Logger" doc:id="a74dbf49-d111-4eb3-84c3-598845ecaf48" />
    </flow>
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Rahul
  • 21
  • 1
  • 3

1 Answers1

0

What is the location in which the XSD files are present? The path needs to be specified for the XSD as mentioned here

Reading file is the problem. Similar issue is faced while reading mUnit input file also. In these cases, files can be read as : getResourceAsString or getResourceAsStream

This should be helpful.