Announcement

Collapse
No announcement yet.

MIRTH 3.8 openjdk11 and ms sql JDBC

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

  • MIRTH 3.8 openjdk11 and ms sql JDBC

    I recently update our mirth server and it bring by default to run on openjdk11.
    I have a few channel that connect to SQL 2014 and I was using the MS SQL JDBC (sqljdbc42.jar) custom-lib.

    I did all the configuration again... adding the jar in the custom-lib and edit the dbdrivers.xml adding the SQL jar driver.

    But I cannot make my channel to find the driver JDBC for MS SQL, getting this error:
    ERROR MESSAGE: Error evaluating transformer
    java.lang.NoClassDefFoundError: java/sql/Driver

    However when I switch back to java8_64, the channel work fine and connect to the SQL.

    What do I need to do to make it works?

    PS: using the net.sourceforge.jtds.jdbc.Driver doesn't work with these SQL servers, it has some security level problem and the sql server reject the connection. I have to switch to MS SQL JDBC two years ago.

  • #2
    Can't tell from your post if you already did this or not, but in the user guide it has instructions for what to do if you are running on java version 9 or higher. It involves adding a few lines to your vmoptions file.

    Comment


    • #3
      Originally posted by agermano View Post
      Can't tell from your post if you already did this or not, but in the user guide it has instructions for what to do if you are running on java version 9 or higher. It involves adding a few lines to your vmoptions file.
      I think that you are referring to this "In order to run Mirth Connect in Java 9 or greater, copy the options from /docs/mcservice-java9+.vmoptions and append them to either mcserver.vmoptions or mcservice.vmoptions, depending on your deployment. Then restart Mirth Connect" and I believe that is the case for Mirth installed on Windows or Linux machine but not for a Mirth Appliance.

      I took a look in all the folders in my VMware appliance and there is not "mcserver.vmoptions" or "mcserver.vmoptions" that I could edit.

      Thanks
      Last edited by cguanes; 08-26-2019, 01:05 PM.

      Comment


      • #4
        You're correct that you should not have to make the vmoptions changes manually on an Appliance.

        Regarding the JDBC issue, in 3.8, the dbdrivers.xml file is no longer used. Instead the information about JDBC drivers is stored in the database and you can modify it through the Administrator. See https://www.mirthcorp.com/community/...erimprovements.

        It's worth checking that the JDBC driver is configured correctly in the Administrator UI.

        Comment


        • #5
          I am running Mirth Connect 3.8.0 on Ubuntu 18.4 with OpenJDK 11 and I am having that exact issue on three separate servers. The mcserver.vmoptions/mcservice.vmoptions modification has been performed to no avail. SOME channels are consistently throwing the exception "java.lang.NoClassDefFoundError: java/sql/Driver" while others seem to work just fine (until they stop working). It is all pretty random and so far, I wasn't able to find a workaround.

          Comment


          • #6
            Resolved my issue by removing dependency on one particularly big and hairy legacy JAR compiled under Java 8. Somehow the third-party java binary was causing a conflict with JTDS. I guess, the JAR needed to be recompiled for JDK 11, but since I didn't really need it, removing the reference fixed the JDBC issue.

            Comment


            • #7
              Hey aitougan,

              I am running into the same issue on openjdk-11 and 13 with the open9jvm running on RHEL (java.lang.NoClassDefFoundError: java/sql/Driver). My oddity was I had a test instance on 3.7 that not only did not have this issue, but I didn't even change the vmoptions per the documentation and it worked.

              Which jar did you kill your reference on, and where did you kill it?
              Specs
              ====
              Mirth 2.2 Windows 2008 R2 2core 8gb java 8
              Mirth 3.8 RHEL 7.6 4core 16gb OpenJDK13
              Mirth 3.8 CentOS 7 4core 16gb OpenJDK13

              Comment


              • #8
                Resolved my issue by one of two ways (not sure which...or both)
                1. removed ojdbc6.jar from custom-libs (I was having some connection issues with 7 and was testing backwards compatibility). This matches aitougan's solution by removing an ancient jar
                2. added the read-only database url in the mirth.properties file. It wasn't different from the regular connection url (it's a dedicated MSSS instance) but the stack trace was leading me to it (I had no custom drivers installed, either) and I had the read-only max-connections set.

                Unfortunately, I did both at the same time, overrode the java home to look for openJDK13 (w/openj9 vm), and added the java9+ lines to the mcservice.vmoptions

                Code:
                java.lang.NoClassDefFoundError: java.sql.Driver
                at java.base/java.lang.ClassLoader.defineClassImpl(Native Method)
                ...yadda adda...
                at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1067)
                at com.mirth.connect.connectors.jdbc.CustomDriver.<init>(CustomDriver.java:40)
                at com.mirth.connect.server.userutil.DatabaseConnectionFactory.initializeDriverAndGetInfo(DatabaseConnectionFactory.java:145)
                at com.mirth.connect.server.userutil.DatabaseConnectionFactory.getCustomDriverInfo(DatabaseConnectionFactory.java:167)
                at com.mirth.connect.server.userutil.DatabaseConnectionFactory.createDatabaseConnection(DatabaseConnectionFactory.java:54)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                Specs
                ====
                Mirth 2.2 Windows 2008 R2 2core 8gb java 8
                Mirth 3.8 RHEL 7.6 4core 16gb OpenJDK13
                Mirth 3.8 CentOS 7 4core 16gb OpenJDK13

                Comment


                • #9
                  Same issue here ... with Mirth Connect 3.8.1 and OpenJDK 11

                  Issue occurs only when custom-lib folder contains a jar ...

                  Not been able to detect which jars/libraries cause the issue...

                  Workarround specified in thread "http://www.mirthproject.org/community/forums/showthread.php?t=220392&highlight=java%2Fsql%2FDri ver" works perfect !


                  // workarround
                  var driver = new com.mirth.connect.connectors.jdbc.CustomDriver(jav a.lang.Thread.currentThread().getContextClassLoade r(),
                  "org.postgresql.Driver");

                  var info = new java.util.Properties();
                  info.setProperty("user", "mydbuser");
                  info.setProperty("password", "mysecretdbpassword");

                  var dbConn = new com.mirth.connect.server.userutil.DatabaseConnecti on(driver,
                  "jdbcostgresql://localhost:5432/testdb", info);

                  Comment

                  Working...
                  X