Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

All entries tagged roxy.

You can subscribe to an RSS feed of this list.

Nov 2017

  • I have a Marklogic 9 project that I’m configuring with Roxy. I’ve been following these examples:

    Basically, I have a server-side JS function that I want to call after deploy content. I have something like this:

    then you would define your new method

      def deploy_content
        # you can optionally call the original
        # do your stuff here
          xquery version "1.0-ml";
          xdmp:javascript-eval('var process = require("/ingestion/process.sjs"); process.postDeployContent();')
        :db_name => @properties[""] + "-content")

    The xquery being called here evaluates fine when executed via query console. But when I call ml local deploy content, I get the following error:

    ERROR: 500 "Internal Server Error"
    ERROR: <html xmlns="">
        <title>500 Internal Server Error</title>
        <meta name="robots" content="noindex,nofollow"/>
        <link rel="stylesheet" href="/error.css"/>
        <span class="error">
          <h1>500 Internal Server Error</h1>
            <dt>XDMP-MODNOTFOUND: var process = require("/ingestion/process.sjs"); process.postDeployContent(); -- Module /ingestion/process.sjs not found</dt>
            <dt>in [anonymous], at 1:14 [javascript]</dt>
            <dt>at 3:6,
    in xdmp:eval("var process = require(&amp;quot;/ingestion/process.sjs&amp;quot;); proce...") [javascript]</dt>
            <dt>in /eval, at 3:6 [1.0-ml]</dt>

    Why is the module not found when running via xquery from app_specific.rb?

    Or… is there a better way to call a JS module function from here. Sorry, I’m not too familiar with the xquery side, so I just called a JS function instead.

Oct 2017

  • I’m trying out the Roxy deployer. The Roxy app was created using the default app-type. I setup a new ML 9 database, and I ran “ml local bootstrap” using the default ports (8040 and 8041)

    Then I setup a node application. I tried the following (sample code from

    var marklogic = require('marklogic');
    var conn = {
        host: '',  
        port: 8040,
        user: 'admin',
        password: 'admin',
        authType: 'DIGEST'
    var db = marklogic.createDatabaseClient(conn);
      {author: 'Beryl Markham'},
      {author: 'WG Sebald'}
    .result(function(response) {
        console.log(JSON.stringify(response, null, 2));
      }, function (error) {
        console.log(JSON.stringify(error, null, 2));

    Running the script gave me an error like:

    $ node test.js
      "message": "write document list: cannot process response with 500 status",
      "statusCode": 500,
      "body": "<error:error xsi:schemaLocation=\" error.xsd\" xmlns:error=\"\" xmlns:xsi=\"\">\n  <error:code>XDMP-IMPMODNS</error:code>\n  <error:name>err:XQST0059</error:name>\n  <error:xquery-version>1.0-ml</error:xquery-version>\n  <error:message>Import module namespace mismatch</error:message>\n  <error:format-string>XDMP-IMPMODNS: (err:XQST0059) Import module namespace does not match target namespace of imported module /MarkLogic/rest-api/endpoints/config.xqy</error:format-string>\n  <error:retryable>false</error:retryable>\n  <error:expr/>\n  <error:data>\n    <error:datum></error:datum>\n    <error:datum></error:datum>\n    <error:datum>/MarkLogic/rest-api/endpoints/config.xqy</error:datum>\n  </error:data>\n  <error:stack>\n    <error:frame>\n      <error:uri>/roxy/lib/rewriter-lib.xqy</error:uri>\n      <error:line>5</error:line>\n      <error:column>0</error:column>\n      <error:xquery-version>1.0-ml</error:xquery-version>\n    </error:frame>\n  </error:stack>\n</error:error>\n"

    If I change the port to 8000 (the default appserver that inserts into Documents), the node function executes correctly as expected. I’m not sure if I need to configure anything else with the Roxy-created appserver so that it works with the node.js application.

    I’m not sure where the “DELETE_IF_UNUSED” part in the error message is coming from either. There doesn’t seem to be any such text in the configuration files generated by Roxy.

    Edit: When accessing via the browser, I get a an xml with a similar error:

    <error:error xsi:schemaLocation=" error.xsd" xmlns:error="" xmlns:xsi="">
      <error:message>Import module namespace mismatch</error:message>
      <error:format-string>XDMP-IMPMODNS: (err:XQST0059) Import module namespace does not match target namespace of imported module /MarkLogic/rest-api/endpoints/config.xqy</error:format-string>

    If it matters, MarkLogic version is 9.0-3.1. It’s a fresh install too.

    Any advice?