1

Using this as reference, Invoking Mirth Connect CLI with Powershell script, we are following these instructions on a docker container, translating it as best as we can but we are getting this error message now which appears related to Java.

"Error: Could not find or load main class com.install4j.runtime.launcher.UnixLauncher"

Tried a few things playing around with the Java environment variable but no dice yet. Also tried to place the zip4J library in the custom-lib folder of mirth.

Any help would be great.

mac
  • 307
  • 2
  • 17
  • Just to add a new error message from mccomand saying only Java 1.3 up to to Java 1.6 are supported. Mirth is running on Java 1.8 which is the current version of Java running on this docker container. – mac Dec 19 '19 at 19:10

3 Answers3

3

It worked for me to bypass the install4j stuff. I have a custom docker image, but this or something similar should work with yours.

docker run --rm -it -w /opt/mirthconnect agermano/mirth java \
-jar mirth-cli-launcher.jar -u admin_user -p admin_pass -a "https://172.21.0.2:8443/"

If the container's java binary isn't in your path, you will need to specify the full path. The main thing install4j is doing is trying to find it for you. The -w option is for the working directory and should point to where mirth is installed in the container.

This above command is to run the client interactively. To pass a script file you can map a local file as a volume.

docker run --rm -v $PWD/docker-commands.txt:/opt/mirthconnect/commands.txt \
-w /opt/mirthconnect agermano/mirth java -jar mirth-cli-launcher.jar \
-u admin_user -p admin_pass -a "https://172.21.0.2:8443/" -s commands.txt
agermano
  • 1,679
  • 6
  • 16
  • Thanks, I will give that a try and hopefully will get pass the error I;m getting now. Happy Holidays – mac Dec 20 '19 at 17:41
1

For anyone trying to restore or modify a channel configuration, the best way I found is to use the rest API. You can try your settings using Postman and see the results immediately in Mirth. For our use case, configuring a container with mirth and its respective configuration, it worked like a charm using the REST API. A listing of all API options is available right from Mirth, on the left side there is a link to the documentation, with samples and fields that can be used to test with Postman. Hope this helps.

mac
  • 307
  • 2
  • 17
  • Your question was about invoking mirth cli from docker, not restoring or modifying channel configurations. This answer is useful information, but it answers a different question. – agermano Dec 30 '19 at 19:13
1

Bumping an ancient thread because I was also having trouble automatically importing channels into a docker container.

My solution was to leverage the API using wget and curl.

Be sure to declare a name for the mirth connect container when running docker: sudo docker run -d --name mirth-container-name -p 8443:8443 -p 6661:6661 nextgenhealthcare/connect

Then use wget to pull the channel xml to a temp folder in the docker container: sudo docker exec mirth-container-name wget -q –auth-no-challenge –header='Accept:application/octet-stream' "https://raw.githubusercontent.com/marlycormar/mirth-connect-channel-examples/master/channels/json_to_hl7_dest_channel_writer/channel.xml" -O /tmp/channel.xml

then, use curl to import the channel to mirth connect: sudo docker exec mirth-container-name curl --insecure -X POST "https://admin:admin@localhost:8443/api/channels" -H "accept: application/json" -H "Content-Type: application/xml" -H "X-Requested-With: OpenAPI" -d @/tmp/channel.xml

and finally use curl to redeploy all channels: sudo docker exec mirth-container-name curl --insecure -X POST "https://admin:admin@localhost:8443/api/channels/_redeployAll" -H "accept: application/xml" -H "X-Requested-With: OpenAPI"