Announcement

Collapse

NextGen (Mirth) Connect 3.11.0 Released!

NextGen (Mirth) Connect 3.11.0 is now available as an appliance update and on our GitHub page. This release contains improvements to licensing and the NCPDP data type. It also includes various security fixes, general bug fixes, and improvements to commercial extensions. See the release notes for the complete list of fixes and improvements.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Run Mirth service manually works, running from systemd errs with "No suitable JVM..."

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Run Mirth service manually works, running from systemd errs with "No suitable JVM..."

    I'm trying to configure my Mirth Connect 3.9.0 to restart automatically when my server reboots.


    1. This is my service file (paths are corrects, the configuration validates with $ systemd-analyze verify mirth.service):

    $ nano /usr/lib/systemd/system/mirth.service

    [Unit]
    Description=MirthConnect
    After=network.target

    [Service]
    Type=forking
    User=root
    Group=root
    ExecStart=/opt/mirth/mcservice start
    ExecStop=/opt/mirth/mcservice stop
    TimeoutSec=60

    [Install]
    WantedBy=multi-user.target


    2. Enable and run

    $ systemctl enable mirth

    Created symlink /etc/systemd/system/multi-user.target.wants/mirth.service → /lib/systemd/system/mirth.service.


    $ systemctl start mirth

    ERROR


    $ systemctl status mirth

    ● mirth.service - MirthConnect
    Loaded: loaded (/lib/systemd/system/mirth.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Fri 2021-04-09 16:35:49 UTC; 6min ago
    Process: 998 ExecStart=/opt/mirth/mcservice start (code=exited, status=83)

    Apr 09 16:35:49 localhost systemd[1]: Starting MirthConnect...
    Apr 09 16:35:49 localhost mcservice[998]: No suitable Java Virtual Machine could be found on your system.
    Apr 09 16:35:49 localhost mcservice[998]: The version of the JVM must be at least 1.8.
    Apr 09 16:35:49 localhost mcservice[998]: Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.

    Apr 09 16:35:49 localhost systemd[1]: mirth.service: Control process exited, code=exited, status=83/n/a
    Apr 09 16:35:49 localhost systemd[1]: mirth.service: Failed with result 'exit-code'.
    Apr 09 16:35:49 localhost systemd[1]: Failed to start MirthConnect.



    3. Running manually works like a charm

    $ cd /opt/mirth
    $ ./mcservice start

    Starting mcservice


    $ ./mcservice status

    mcservice is running.


    $ netstat -tulpn

    I see Mirth ports are being used by a java process, which is Mirth



    Why does it run OK manually but asks for a JVM from the service?

    I have tested with openJDK 1.8 and 11, same results (manual runs OK, service doesn't).


    Thanks.

  • #2
    echo your path and other env vars to debug in the script.

    mcservice (from mirth) can also override the JVM search sequence, it is commented out at the top of the file.

    Diridium Technologies, Inc.
    https://diridium.com

    Comment


    • #3
      Do you mean changing the mcservice to echo PATH and ENV?

      Should I uncomment something there? Can you point me to the exact lines?

      Thanks.

      Comment


      • #4
        What flavor of Linux are you using?
        Diridium Technologies, Inc.
        https://diridium.com

        Comment


        • #5
          this is ubuntu 19

          Comment


          • #6
            I would guess that when you run this manually, you are not logged in as root? It is good practice to set up the service to run as a user other than root, too.

            Maybe you just need to set that environment variable to point to the java installation. I found this SO answer that describes how to set the variable for your service.

            https://serverfault.com/questions/41...ystemd-service

            Comment


            • #7
              1. please check my first post, it mentions how it's run

              2. yes, it is root user

              3. the env var is set

              Comment

              Working...
              X