NextGen (Mirth) Connect & MongoDB java 驱动程序错误

NextGen (Mirth) Connect & MongoDB java driver error

我正在尝试配置 Mirth Connect Server 3.10.1(Java 版本:1.8.0_181),以将 FHIR JSON 文档写入 MongoDB。我已按照 this post 的说明进行操作,并在 custom-lib/

中安装了这些驱动程序

我的 conf/dbdrivers.xml 有这样的条目,

<driver class"org.mongodb.Driver" name="MongoDB" template="mongodb://localhost:27017/" selectLimit="" />

我已经使用 JavaScript Writer 连接器类型设置了我的频道目标并使用了这个 JS,

var mongoClient = new Packages.com.mongodb.MongoClient("localhost", 27017);
var database = mongoClient.getDatabase("synthea");
var collection = database.getCollection("synthea");                   
var jsonDoc = JSON.stringify(connectorMessage.getEncodedData(msg));
var doc = Packages.org.bson.Document.parse(jsonDoc);

collection.insertOne(doc);
var myDoc = collection.find().first();
logger.debug(myDoc.toJson());

mongoClient.close();

return;

部署频道时出现此错误。

谁能告诉我这是什么意思?

非常(谦虚地)感谢任何帮助或指导。

JavaScript Writer error
ERROR MESSAGE: Error evaluating JavaScript Writer
java.lang.NoSuchMethodError: 'com.mongodb.connection.ConnectionPoolSettings$Builder com.mongodb.connection.ConnectionPoolSettings$Builder.maxWaitQueueSize(int)'
    at com.mongodb.MongoClientOptions.<init>(MongoClientOptions.java:149)
    at com.mongodb.MongoClientOptions.<init>(MongoClientOptions.java:57)
    at com.mongodb.MongoClientOptions$Builder.build(MongoClientOptions.java:1612)
    at com.mongodb.MongoClient.<init>(MongoClient.java:155)
    at com.mongodb.MongoClient.<init>(MongoClient.java:145)
    at jdk.internal.reflect.GeneratedConstructorAccessor135.newInstance(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
    at org.mozilla.javascript.MemberBox.newInstance(MemberBox.java:171)
    at org.mozilla.javascript.NativeJavaClass.constructInternal(NativeJavaClass.java:268)
    at org.mozilla.javascript.NativeJavaClass.constructSpecific(NativeJavaClass.java:207)
    at org.mozilla.javascript.NativeJavaClass.construct(NativeJavaClass.java:169)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1713)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1009)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:412)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3545)
    at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:121)
    at com.mirth.connect.server.util.javascript.JavaScriptTask.executeScript(JavaScriptTask.java:150)
    at com.mirth.connect.connectors.js.JavaScriptDispatcher$JavaScriptDispatcherTask.doCall(JavaScriptDispatcher.java:230)
    at com.mirth.connect.connectors.js.JavaScriptDispatcher$JavaScriptDispatcherTask.doCall(JavaScriptDispatcher.java:190)
    at com.mirth.connect.server.util.javascript.JavaScriptTask.call(JavaScriptTask.java:113)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:832)

我感觉这是因为驱动程序版本不匹配。版本 3.9 has the method indicated in the error, but 4.2 没有。

整理好之后,您将要更改此行

var jsonDoc = JSON.stringify(connectorMessage.getEncodedData(msg));

至此

var jsonDoc = connectorMessage.getEncodedData();

msg 不存在于 Javascript Writer 中,connectorMessage.getEncodedData() 不接受任何参数,returns 一个字符串。 connectorMessage 是 Mirth 用户 API.

ImmutableConnectorMessage 实例