Error encountered with the NextGen (Mirth) Connect and MongoDB Java driver connection

I'm currently in the process of setting up Mirth Connect Server 3.10.1 (Java version: 1.8.0_181) to write FHIR JSON documents to MongoDB. Following the instructions provided in this post, I have included the following drivers in my custom-lib/ directory:

  • bson-4.2.0.jar
  • mongodb-driver-3.9.1.jar
  • mongodb-driver-core-4.2.0.jar

Within my conf/dbdrivers.xml file, I have an entry that looks like this:

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

For my Channel Destination, I have selected a JavaScript Writer Connector Type and utilized the following JavaScript code:

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;

Upon deploying the Channel, I encountered the following error message:

If anyone can shed some light on what this error signifies, I would greatly appreciate it.

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)

Answer №1

It seems like the issue could be related to the different versions of the drivers being used. The method mentioned in the error is available in version 3.9, but not in 4.2.

Once this is resolved, the line below needs to be updated:

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

It should be changed to:

var jsonDoc = connectorMessage.getEncodedData();

In a Javascript Writer, there is no msg parameter. Additionally,

connectorMessage.getEncodedData()
does not require any parameters and returns a String. connectorMessage is an instance of ImmutableConnectorMessage from the Mirth User API.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to modify attribute within $templateCache through an AngularJS Directive

Here is my Directive code: module.directive('iconSwitcher', function() { return { restrict : 'A', link : function(scope, elem, attrs) { var currentState = true; elem.on('click', function() { ...

What methods can be used to improve the precision of measuring one-way network latency?

There are a couple of methods known for approximating one-way network latency: One way is to calculate the two-way latency between networks and then divide it by 2. This provides a rough estimate of the time taken. Alternatively, you can utilize the Netwo ...

Encountering a connection issue, the connection attempt has timed out: unable to

While running a basic java program to connect to the URL "", I encountered a connection timed out exception when attempting to fetch a response code. The section of code causing the issue is shown below: url = new URL("http://www.google.co.in/?gws_rd=ssl ...

The change event for the select element is malfunctioning

Currently, I am deep diving into Nodejs with the second edition of the node cookbook. This book has caught my attention because it explains concepts using practical sample code, making it easier to grasp. The example code I am working on is related to Br ...

After clicking, I would like the text from the list item to have a style of "background-color: aqua" when displayed in the textarea

Is there a way to apply a highlight with a style of "background-color: aqua" in the textarea only to the word selected from the list above after clicking on it? See below for my HTML: <head> <script src="https://ajax.googleapis.com/ajax/libs/ ...

Tips for aligning an image in the middle of a column within an ExtJS GridPanel

My goal is to center the icon horizontally within the "Data" column: Currently, I have applied textAlign: center to the column: Additionally, I am using CSS in the icon renderer function to horizontally center it: Despite these efforts, the icon remains ...

What is the best approach for manipulating live data in localStorage using ReactJS?

I am working on creating a page that dynamically renders data from localStorage in real-time. My goal is to have the UI update instantly when I delete data from localStorage. Currently, my code does not reflect changes in real-time; I have to manually rel ...

Execute tests on changing files using cypress.io

I'm currently experimenting with using Cypress to test a large Angular application that I've developed. What I want to achieve is to load an expectation file into my test and then run the test based on this expectation file. Despite trying diffe ...

utilize jQuery and AngularJS to transform a JSON object into a nested JSON structure

Is there a way to convert my current JSON file into a nested JSON structure like the one below? I've attempted various methods (How to convert form input fields to nested JSON structure using jQuery), but I'm not achieving the desired outcome. Ca ...

Tips for navigating upwards to a specific element and successfully clicking on it in Selenium

I am facing a situation where the system needs to scroll upwards to reach the web element located in the left panel of the page and then click on it to proceed with other operations. I have attempted various methods but none seem to be effective. Can anyon ...

Using a single quotation mark in a MongoDB document

When a user enters a search query in my HTML page and sends it via the GET method, I encounter an issue with results not being returned if the query contains a single quotation mark. This is because some of my MongoDB documents have fields with single qu ...

Apply the "ng-class" attribute to the parent of the chosen element

Another question arises in relation to the usage of ng-class... How can we dynamically add a class to the <ul> element when a <button> within its <li> is clicked? Check out the demo here Here is the HTML code snippet: <div ng-app=" ...

Tips for passing a value or argument to the map function in JavaScript

Can someone guide me on how to pass a variable in the map function using JavaScript? const obj = ["Singapore", "Malaysia"] const pr = ["SG", "MY"] // need to pass value to map function render(){ obj.map((val, index) => { return html` <p ...

bootstrap-vue tabs - reveal specific tab content based on URL anchor tag

For my SPA, I am utilizing bootstrap-vue and currently working on a page where nested content needs to be placed within b-tabs. If given a URL with an anchor (e.g. www.mydomain.com/page123#tab-3), the goal is to display the content under Tab 3. Query: Ho ...

Develop an ngDialog template that can be easily reused across different projects

I am interested in developing a reusable template for my application. As far as I know, it seems like you can't directly pass the title and body to ngDialog. What I'm looking for is something similar to the following : <div> <h2>{{ ...

Iterate over the contents within the div tag

I need help with looping through the data in this specific div container. My goal is to extract row by row data from it. <div id="result" runat=server> <div id="gvResult" class="RowGroup"> <div class="Row RowBg" tabindex="99"> ...

Issue encountered during ag-grid version upgrade: unable to locate compatible row model for rowModelType 'virtual'

Recently, I updated my ag-grid version from v7.0.2 to v11.0.0, and after the upgrade, all tables with infinite scrolling functionality stopped working abruptly. The browser console displayed the following error message: ag-Grid: count not find matching ...

Angular: Exploring the differences between $rootScope variable and event handling

I have a dilemma with an app that handles user logins. As is common in many apps, I need to alter the header once the user logs in. The main file (index.html) utilizes ng-include to incorporate the header.html I've come across two potential solution ...

The event fails to propagate up to the parent component

I have a project structure set up as follows: https://i.stack.imgur.com/bvmK5.jpg The todo-form component triggers the created event and I am looking to handle this event in the todos component. todo-form.component.html: <form class="todo-form" ( ...

What is the method for configuring my bot to forward all logs to a specific channel?

const logsChannel = message.guild.channels.cache.find(channel => channel.name === 'logs'); I am looking to set up my bot to send log messages for various events, like member join/leave or message deletion, specifically in a channel named &apo ...