4

I'm trying to run an absolutely minimal harmonization flow to test out the Data Hub Framework (DHF), but the flow fails every time.

After creating a new harmonization flow (default settings, tried with blank template and creating from entity definition) and trying to run, it starts the 'collector' process and fails almost immediately. No information is logged in the trace file, or the debug output log file.

The debug log from creating the harmonization flow to when it fails is:

11:55:26.777 [Thread-199] ERROR com.marklogic.hub.util.MlcpRunner - C:\Program Files\Java\jre1.8.0_171\bin\java -Dlogback.configurationFile=file:/C:/Users/ThomasUr/AppData/Local/Temp/mlcp-7521231720687096565-logger.xml -jar quick-start-3.0.0.war mlcp IMPORT -document_type xml -host localhost -input_file_path C:\Projects\HQJOC\sampleXML -input_file_type documents -modules_root / -output_collections sample_xml_2 -output_permissions rest-reader,read,rest-writer,update -output_uri_replace /C:/Projects/HQJOC/sampleXML,'' -password {removed} -port 8010 -transform_module /MarkLogic/data-hub-framework/transforms/mlcp-flow-transform.sjs -transform_namespace http://marklogic.com/data-hub/mlcp-flow-transform -transform_param "entity-name=default,flow-name=load%20xml,job-id=59089758-ba65-4853-9b41-86902046b085" -username {removed}
11:56:24.429 [http-nio-8080-exec-4] INFO  c.m.h.scaffold.impl.ScaffoldingImpl - writing: scaffolding/harmonize/sjs/collector.sjs => C:\Projects\HQJOC\data-hub\plugins\entities\default\harmonize\default to final\collector.sjs
11:56:24.429 [http-nio-8080-exec-4] INFO  c.m.h.scaffold.impl.ScaffoldingImpl - writing: scaffolding/harmonize/sjs/writer.sjs => C:\Projects\HQJOC\data-hub\plugins\entities\default\harmonize\default to final\writer.sjs
11:56:26.491 [SimpleAsyncTaskExecutor-27] INFO  c.m.hub.impl.EntityManagerImpl - min modified: 1530143659182
11:56:27.851 [http-nio-8080-exec-4] INFO  c.m.h.scaffold.impl.ScaffoldingImpl - writing: C:\Projects\HQJOC\data-hub\plugins\entities\default\harmonize\default to final\content.sjs
11:56:27.866 [http-nio-8080-exec-4] INFO  c.m.h.scaffold.impl.ScaffoldingImpl - writing: scaffolding/harmonize/sjs/headers.sjs => C:\Projects\HQJOC\data-hub\plugins\entities\default\harmonize\default to final\headers.sjs
11:56:27.866 [http-nio-8080-exec-4] INFO  c.m.h.scaffold.impl.ScaffoldingImpl - writing: scaffolding/harmonize/sjs/triples.sjs => C:\Projects\HQJOC\data-hub\plugins\entities\default\harmonize\default to final\triples.sjs
11:56:27.866 [http-nio-8080-exec-4] INFO  c.m.h.scaffold.impl.ScaffoldingImpl - writing: scaffolding/harmonize/sjs/main.sjs => C:\Projects\HQJOC\data-hub\plugins\entities\default\harmonize\default to final\main.sjs
11:56:31.867 [SimpleAsyncTaskExecutor-26] INFO  c.m.hub.impl.EntityManagerImpl - min modified: 1530143659182
11:56:31.882 [SimpleAsyncTaskExecutor-28] INFO  c.m.hub.impl.EntityManagerImpl - min modified: 1530143659182
11:56:32.585 [SimpleAsyncTaskExecutor-26] INFO  c.m.hub.util.PerformanceLogger - PERFORMANCE: DataHubService.installUserModules took 7.1413238s
11:56:32.648 [SimpleAsyncTaskExecutor-28] INFO  c.m.hub.util.PerformanceLogger - PERFORMANCE: DataHubService.installUserModules took 3.7676026s
11:56:32.663 [SimpleAsyncTaskExecutor-27] INFO  c.m.hub.util.PerformanceLogger - PERFORMANCE: DataHubService.installUserModules took 6.2057773s

The debug config file ( -Dlogback.configurationFile=file:/C:/Users/ThomasUr/AppData/Local/Temp/mlcp-7521231720687096565-logger.xml ) mentioned in the first line of the above log contains:

<configuration>

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <!-- encoders are assigned the type
         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

  <logger name="org.apache.http" level="WARN"/>

  <logger name="com.marklogic.spring.batch.core.repository.dao.MarkLogicStepExecutionDao" level="WARN"/>
  <logger name="com.marklogic.spring.batch.core.repository.dao.MarkLogicJobExecutionDao" level="WARN"/>
  <logger name="com.marklogic.client.impl.DocumentManagerImpl" level="WARN"/>
  <logger name="com.marklogic.client.impl.DatabaseClientImpl" level="WARN"/>
  <logger name="com.marklogic" level="INFO"/>
  <logger name="com.marklogic.appdeployer" level="INFO"/>
  <logger name="com.marklogic.hub" level="INFO"/>
  <logger name="com.marklogic.contentpump" level="INFO"/>
  <logger name="org.apache.catalina.webresources.Cache" level="ERROR"/>
  <logger name="org.apache.hadoop.util.Shell" level="OFF"/>
  <logger name="org.apache.hadoop.util.NativeCodeLoader" level="ERROR"/>

  <root level="WARN">
    <appender-ref ref="STDOUT" />
  </root>
</configuration>

The entity and flows are as follows: enter image description here

enter image description here

Any ideas on what might be causing this?

EDIT

Error found in 8010_ErrorLogs_1.txt (referenced filename removed):

2018-06-27 13:57:40.363 Info: Exception caught while transforming/[FILENAME].pdf-0-23213: XDMP-AS: $src as node() -- Invalid coercion: null as node()

Note that this same error was found thousands of times in the log file, with different values for [FILENAME] in each line.

Additional error logs on port 8010:

2018-06-28 16:43:52.704 Notice: XDMP-AS: (err:XPTY0004) $uri as xs:string -- Invalid coercion: () as xs:string
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/data-hub-framework/impl/hub-utils-lib.xqy, at 175:2,
2018-06-28 16:43:52.704 Notice:+in hul:get-file-from-uri(()) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $uri = ()
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/data-hub-framework/impl/flow-lib.xqy, at 896:43,
2018-06-28 16:43:52.704 Notice:+in flow:validate-entities() [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $errors = json:object()
2018-06-28 16:43:52.704 Notice:+  $options = map:map()
2018-06-28 16:43:52.704 Notice:+  $entity = <entity xmlns="http://marklogic.com/data-hub"><name>Guides</name>...</entity>
2018-06-28 16:43:52.704 Notice:+  $flow = <flow xmlns="http://marklogic.com/data-hub">&#10;   <name>Docs</name>...</flow>
2018-06-28 16:43:52.704 Notice:+  $data-format = <data-format xmlns="http://marklogic.com/data-hub">xml</data-format>
2018-06-28 16:43:52.704 Notice:+  $_ = ()
2018-06-28 16:43:52.704 Notice:+  $main = <main code-format="xqy" module="/entities/Guides/input/Docs/main.xqy" .../>
2018-06-28 16:43:52.704 Notice:+  $module-uri = attribute{fn:QName("","module")}{"/entities/Guides/input/Docs/main.xqy"}
2018-06-28 16:43:52.704 Notice:+  $ns = "http://marklogic.com/data-hub/plugins"
2018-06-28 16:43:52.704 Notice:+  $ex = <error:error xsi:schemaLocation="http://marklogic.com/xdmp/error error.xsd" .../>
2018-06-28 16:43:52.704 Notice:+  $uri = ()
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/data-hub-framework/extensions/validate.xqy, at 54:19,
2018-06-28 16:43:52.704 Notice:+in function() as item()*() [1.0-ml]
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/data-hub-framework/impl/perflog-lib.xqy, at 33:9,
2018-06-28 16:43:52.704 Notice:+in perf:log("/v1/resources/validate:get", function() as item()*) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $what = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $func = map:map()
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/data-hub-framework/extensions/validate.xqy, at 51:2,
2018-06-28 16:43:52.704 Notice:+in xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy")(map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map()) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $context = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $params = map:map()
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy, at 944:44,
2018-06-28 16:43:52.704 Notice:+in extut:call-service("ml:validate", "GET", xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy"), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(), ()) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $extension-name = "ml:validate"
2018-06-28 16:43:52.704 Notice:+  $method = "GET"
2018-06-28 16:43:52.704 Notice:+  $service = xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy")
2018-06-28 16:43:52.704 Notice:+  $context = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $service-params = map:map()
2018-06-28 16:43:52.704 Notice:+  $input = ()
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy, at 898:20,
2018-06-28 16:43:52.704 Notice:+in function() as item()*() [1.0-ml]
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy,
2018-06-28 16:43:52.704 Notice:+in xdmp:invoke(function() as item()*, <options xmlns="xdmp:eval"><isolation>same-statement</isolation><ignore-amps>...</ignore-amps></options>) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy, at 896:12,
2018-06-28 16:43:52.704 Notice:+in extut:invoke-service("ml:validate", "GET", "query", xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy"), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(), (), fn:false()) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $extension-name = "ml:validate"
2018-06-28 16:43:52.704 Notice:+  $method = "GET"
2018-06-28 16:43:52.704 Notice:+  $default-txn-mode = "query"
2018-06-28 16:43:52.704 Notice:+  $service = xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy")
2018-06-28 16:43:52.704 Notice:+  $context = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $service-params = map:map()
2018-06-28 16:43:52.704 Notice:+  $input = ()
2018-06-28 16:43:52.704 Notice:+  $in-txn = fn:false()
2018-06-28 16:43:52.704 Notice:+  $txn-curr = "query"
2018-06-28 16:43:52.704 Notice:+  $txn-mode = "query"
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/models/resource-model-query.xqy, at 206:20,
2018-06-28 16:43:52.704 Notice:+in rsrcmodqry:resource-get("ml:validate", map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(), fn:false(), local:rsrcmod-callback#6) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $resource-name = "ml:validate"
2018-06-28 16:43:52.704 Notice:+  $context = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $resource-params = map:map()
2018-06-28 16:43:52.704 Notice:+  $in-txn = fn:false()
2018-06-28 16:43:52.704 Notice:+  $responder = local:rsrcmod-callback#6
2018-06-28 16:43:52.704 Notice:+  $service = xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy")
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/models/resource-model-query.xqy, at 175:4,
2018-06-28 16:43:52.704 Notice:+in rsrcmodqry:exec-get(map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), local:rsrcmod-callback#6) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $headers = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $endpoint-params = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $responder = local:rsrcmod-callback#6
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/endpoints/resource-service-query.xqy, at 74:8 [1.0-ml]
2018-06-28 16:43:52.704 Notice: XDMP-AS: (err:XPTY0004) $uri as xs:string -- Invalid coercion: () as xs:string
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/data-hub-framework/impl/hub-utils-lib.xqy, at 175:2,
2018-06-28 16:43:52.704 Notice:+in hul:get-file-from-uri(()) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $uri = ()
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/data-hub-framework/impl/flow-lib.xqy, at 896:43,
2018-06-28 16:43:52.704 Notice:+in flow:validate-entities() [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $errors = json:object()
2018-06-28 16:43:52.704 Notice:+  $options = map:map()
2018-06-28 16:43:52.704 Notice:+  $entity = <entity xmlns="http://marklogic.com/data-hub"><name>Guides</name>...</entity>
2018-06-28 16:43:52.704 Notice:+  $flow = <flow xmlns="http://marklogic.com/data-hub">&#10;   <name>Docs</name>...</flow>
2018-06-28 16:43:52.704 Notice:+  $data-format = <data-format xmlns="http://marklogic.com/data-hub">xml</data-format>
2018-06-28 16:43:52.704 Notice:+  $_ = ()
2018-06-28 16:43:52.704 Notice:+  $main = <main code-format="xqy" module="/entities/Guides/input/Docs/main.xqy" .../>
2018-06-28 16:43:52.704 Notice:+  $module-uri = attribute{fn:QName("","module")}{"/entities/Guides/input/Docs/main.xqy"}
2018-06-28 16:43:52.704 Notice:+  $ns = "http://marklogic.com/data-hub/plugins"
2018-06-28 16:43:52.704 Notice:+  $ex = <error:error xsi:schemaLocation="http://marklogic.com/xdmp/error error.xsd" .../>
2018-06-28 16:43:52.704 Notice:+  $uri = ()
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/data-hub-framework/extensions/validate.xqy, at 54:19,
2018-06-28 16:43:52.704 Notice:+in function() as item()*() [1.0-ml]
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/data-hub-framework/impl/perflog-lib.xqy, at 33:9,
2018-06-28 16:43:52.704 Notice:+in perf:log("/v1/resources/validate:get", function() as item()*) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $what = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $func = map:map()
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/data-hub-framework/extensions/validate.xqy, at 51:2,
2018-06-28 16:43:52.704 Notice:+in xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy")(map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map()) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $context = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $params = map:map()
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy, at 944:44,
2018-06-28 16:43:52.704 Notice:+in extut:call-service("ml:validate", "GET", xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy"), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(), ()) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $extension-name = "ml:validate"
2018-06-28 16:43:52.704 Notice:+  $method = "GET"
2018-06-28 16:43:52.704 Notice:+  $service = xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy")
2018-06-28 16:43:52.704 Notice:+  $context = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $service-params = map:map()
2018-06-28 16:43:52.704 Notice:+  $input = ()
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy, at 898:20,
2018-06-28 16:43:52.704 Notice:+in function() as item()*() [1.0-ml]
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy,
2018-06-28 16:43:52.704 Notice:+in xdmp:invoke(function() as item()*, <options xmlns="xdmp:eval"><isolation>same-statement</isolation><ignore-amps>...</ignore-amps></options>) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy, at 896:12,
2018-06-28 16:43:52.704 Notice:+in extut:invoke-service("ml:validate", "GET", "query", xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy"), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(), (), fn:false()) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $extension-name = "ml:validate"
2018-06-28 16:43:52.704 Notice:+  $method = "GET"
2018-06-28 16:43:52.704 Notice:+  $default-txn-mode = "query"
2018-06-28 16:43:52.704 Notice:+  $service = xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy")
2018-06-28 16:43:52.704 Notice:+  $context = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $service-params = map:map()
2018-06-28 16:43:52.704 Notice:+  $input = ()
2018-06-28 16:43:52.704 Notice:+  $in-txn = fn:false()
2018-06-28 16:43:52.704 Notice:+  $txn-curr = "query"
2018-06-28 16:43:52.704 Notice:+  $txn-mode = "query"
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/models/resource-model-query.xqy, at 206:20,
2018-06-28 16:43:52.704 Notice:+in rsrcmodqry:resource-get("ml:validate", map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(), fn:false(), local:rsrcmod-callback#6) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $resource-name = "ml:validate"
2018-06-28 16:43:52.704 Notice:+  $context = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $resource-params = map:map()
2018-06-28 16:43:52.704 Notice:+  $in-txn = fn:false()
2018-06-28 16:43:52.704 Notice:+  $responder = local:rsrcmod-callback#6
2018-06-28 16:43:52.704 Notice:+  $service = xdmp:function(fn:QName("http://marklogic.com/rest-api/extensions/validate","get"), "/MarkLogic/data-hub-framework/extensions/validate.xqy")
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/models/resource-model-query.xqy, at 175:4,
2018-06-28 16:43:52.704 Notice:+in rsrcmodqry:exec-get(map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), local:rsrcmod-callback#6) [1.0-ml]
2018-06-28 16:43:52.704 Notice:+  $headers = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $endpoint-params = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2018-06-28 16:43:52.704 Notice:+  $responder = local:rsrcmod-callback#6
2018-06-28 16:43:52.704 Notice:+in /MarkLogic/rest-api/endpoints/resource-service-query.xqy, at 74:8 [1.0-ml]
2018-06-28 16:43:53.968 Info: Status 500: XDMP-AS: (err:XPTY0004) $uri as xs:string -- Invalid coercion: () as xs:string
2018-06-28 16:43:53.968 Info: Status 500: XDMP-AS: (err:XPTY0004) $uri as xs:string -- Invalid coercion: () as xs:string

Collector.sjs Flow Step:

function collect(options) {
  // by default we return the URIs in the same collection as the Entity name
  return cts.uris(null, null, cts.collectionQuery(options.entity));
}

module.exports = {
  collect: collect
};

Content.sjs Flow Step:

function createContent(id, options) {
  let doc = cts.doc(id);
  let root = doc.root.toObject();

  let source;

  // for xml we need to use xpath
  if (root && xdmp.nodeKind(root) === 'element') {
    source = root.xpath('/*:envelope/*:instance/node()');
  }
  // for json we need to return the instance
  else if (root && root.envelope && root.envelope.instance) {
    source = root.envelope.instance;
  }
  // for everything else
  else {
    source = doc;
  }

  return extractInstanceXML(source);
}

/**
 * Creates an object instance from some source document.
 * @param source  A document or node that contains
 *   data for populating a XML
 * @return An object with extracted data and
 *   metadata about the instance.
 */
function extractInstanceXML(source) {
  // the original source documents
  let attachments = source;



  // return the instance object
  return {
    '$attachments': attachments,
    '$type': 'XML',
    '$version': '0.0.1'
  }
};


function makeReferenceObject(type, ref) {
  return {
    '$type': type,
    '$ref': ref
  };
}

module.exports = {
  createContent: createContent
};
TUrwin
  • 755
  • 1
  • 5
  • 9
  • Any clues in the MarkLogic error log on port 8010? – Rob S. Jun 28 '18 at 02:11
  • Thanks, honestly didn't realise there were error logs for each app server. As it turns out, there was 1.7GB of clues for port 8010. I've added the error as an edit above. – TUrwin Jun 28 '18 at 03:48
  • Looks like somewhere in your hub code you are casting $uri as a string but it is actually an empty sequence. Can you share the code for the flow? – Rob S. Jun 28 '18 at 13:07
  • It's failing during the Collector flow step. Added the code for it and the Content step above – TUrwin Jun 29 '18 at 01:25
  • Uir is definitely an empty sequence. Can you run this cts.uris(null, null, cts.collectionQuery(options.entity)) in QC (port 8000) with the context database being the stating database and share the results? you'll have to change options.entity to be the name of the entity. which is think you called it default: – Tyler Replogle Aug 27 '18 at 14:06

0 Answers0