DHF、Gradle 和 Marklogic 升级后 mDeploy 失败

问题描述 投票:0回答:1

我们升级了MarkLogic(从10.07到11.0.0)、Gradle(5.2.1到6.4)和DHF(5.2.0到5.8.1)。 所有升级均成功,我们 4 个代码库中的 3 个的 mlDeploy 也成功执行。

但是,一个代码库的 mlDeploy 在尚未完成升级的环境中执行时失败,并出现以下错误,且没有任何错误:

等级错误:

> Task :mlDeployApp FAILED
:mlDeployApp (Thread[Daemon worker,5,main]) completed. Took 3 mins 16.45 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mlDeployApp'.
> Error occurred while loading REST modules: Error occurred while loading modules; host: localhost; port: 8011; cause: Local message: config/resources write failed: Bad Request. Server Message: RESTAPI-INVALIDCONTENT: (err:FOER0000) Invalid content: invalid assemblySegmentation extension: could not parse JavaScript extension assemblySegmentation; please see the server error log for detail JS-JAVASCRIPT:     const bdsQuery = cts.andQuery([ -- Error running JavaScript request: SyntaxError: Unexpected identifier; assemblySegmentation either is not a valid JavaScript module or does not export functions (delete, get, put, post)

MarklLogic 错误日志:

2023-11-06 12:45:52.180 Notice:+  $body = document{text{"const segmentation = require('/custom-modules/segmentationLib..."}}
2023-11-06 12:45:52.777 Info: Status 500: RESTAPI-INVALIDCONTENT: (err:FOER0000) Invalid content: invalid assemblySegmentation extension: could not parse JavaScript extension assemblySegmentation; please see the server error log for detail JS-JAVASCRIPT: Â  Â  const bdsDocument = fn.head(cts.search(bdsQuery)); //bdsPublished Document -- Error running JavaScript request: SyntaxError: Unexpected identifier; assemblySegmentation either is not a valid JavaScript module or does not export functions (delete, get, put, post)
2023-11-06 12:45:53.320 Info: <error:error xsi:schemaLocation="http://marklogic.com/xdmp/error error.xsd" xmlns:error="http://marklogic.com/xdmp/error" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2023-11-06 12:45:53.320 Info:+  <error:code>JS-JAVASCRIPT</error:code>
2023-11-06 12:45:53.320 Info:+  <error:name/>
2023-11-06 12:45:53.320 Info:+  <error:xquery-version>javascript</error:xquery-version>
2023-11-06 12:45:53.320 Info:+  <error:message>Error running JavaScript request</error:message>
2023-11-06 12:45:53.320 Info:+  <error:format-string>JS-JAVASCRIPT: Â  Â  const bdsDocument = fn.head(cts.search(bdsQuery)); //bdsPublished Document -- Error running JavaScript request: SyntaxError: Unexpected identifier</error:format-string>
2023-11-06 12:45:53.320 Info:+  <error:retryable>false</error:retryable>
2023-11-06 12:45:53.320 Info:+  <error:expr>Â  Â  const bdsDocument = fn.head(cts.search(bdsQuery)); //bdsPublished Document</error:expr>
2023-11-06 12:45:53.320 Info:+  <error:data>
2023-11-06 12:45:53.320 Info:+    <error:datum>SyntaxError: Unexpected identifier</error:datum>
2023-11-06 12:45:53.320 Info:+  </error:data>
2023-11-06 12:45:53.320 Info:+  <error:stack>
2023-11-06 12:45:53.320 Info:+    <error:frame>
2023-11-06 12:45:53.320 Info:+      <error:uri>/custom-modules/kcqty-lib/pbsEffLib.sjs</error:uri>
2023-11-06 12:45:53.320 Info:+      <error:line>525</error:line>
2023-11-06 12:45:53.320 Info:+      <error:column>7</error:column>
2023-11-06 12:45:53.320 Info:+      <error:xquery-version>javascript</error:xquery-version>
2023-11-06 12:45:53.320 Info:+    </error:frame>
2023-11-06 12:45:53.320 Info:+    <error:frame>
2023-11-06 12:45:53.320 Info:+      <error:uri>[anonymous]</error:uri>
2023-11-06 12:45:53.320 Info:+      <error:line>1</error:line>
2023-11-06 12:45:53.320 Info:+      <error:column>0</error:column>
2023-11-06 12:45:53.320 Info:+      <error:xquery-version>javascript</error:xquery-version>
2023-11-06 12:45:53.320 Info:+    </error:frame>
2023-11-06 12:45:53.320 Info:+    <error:frame>
2023-11-06 12:45:53.320 Info:+      <error:uri>/marklogic.rest.resource/pbsEff/assets/resource.sjs</error:uri>
2023-11-06 12:45:53.320 Info:+      <error:line>2</error:line>
2023-11-06 12:45:53.320 Info:+      <error:column>18</error:column>
2023-11-06 12:45:53.320 Info:+      <error:operation>xdmp:eval("require(&amp;quot;/marklogic.rest.resource/pbsEff/assets/resource.sj...")</error:operation>
2023-11-06 12:45:53.320 Info:+      <error:xquery-version>javascript</error:xquery-version>
2023-11-06 12:45:53.320 Info:+    </error:frame>

可能是什么原因?我们需要对“sjs”进行任何更改吗?

marklogic marklogic-dhf ml-gradle
1个回答
0
投票

错误消息中有一些看起来很奇怪的字符:

JS-JAVASCRIPT: ┬á ┬á const bdsQuery = cts.andQuery([ -- 运行 JavaScript 请求时出错: SyntaxError: 意外的标识符;

如果读取/写入模块时出现字符编码问题,则可能会导致 JavaScript“意外标识符”异常。 https://runjs.app/blog/how-to-solve-unexpected-identifier-error

请参阅此 ml-gradle wiki 页面,了解显式设置字符编码的方法,以避免导致多字节字符读取不正确的字符编码问题:https://github.com/marklogic/ml-gradle/wiki/编码问题

© www.soinside.com 2019 - 2024. All rights reserved.