Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-905

NullPointerException when using unix sockets on NixOS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 2.6.0
    • Fix Version/s: N/A
    • Component/s: Other
    • Labels:
    • Environment:
      Operating System: NixOS 21.05
      Application: Flyway 7.5.4
      Database: MariaDB 10.5.13

      Description

      The JDBC connector throws a NullPointerException when I try to use it on NixOS with unix domain sockets. I don't know the background of this problem, but I think I should at least get a better error message. Maybe it is some issue with the native part for Unix domain sockets? NixOS is special because you cannot find the .so files at the usual places.

      I noticed another strange aspect regarding this issue. As you can see in the stracktrace, the exception is thrown in setAutoCommit. I would usually expect that this method is only called after authentication. However, I doubt that any authentication took place. In my example below, the user and database are both unknown to the database server. So, if there were any authentication, it should have been rejected by the database server. (I get the same result if I use a valid username and database.)

      DEBUG: Unable to load config file: /nix/store/ic3asrlznl35bfmiyysbk788rjmsv9mc-flyway-7.5.4/share/conf/flyway.conf
      DEBUG: Unable to load config file: /var/empty/flyway.conf
      DEBUG: Unable to load config file: /flyway.conf
      DEBUG: Loading config file: /nix/store/3zjd120k15dnnmc38da65nqry0zbc3qs-flyway.conf
      DEBUG: Directory for Jdbc Drivers not found: /nix/store/ic3asrlznl35bfmiyysbk788rjmsv9mc-flyway-7.5.4/share/drivers
      DEBUG: Adding location to classpath: /nix/store/3gw3hnplqm5q01563404z4vnfr6r456i-mariadb-connector-java-2.7.4/share/java/mariadb-java-client.jar
      DEBUG: Adding location to classpath: /nix/store/sm2n008sc1jrfv987yx7sysqa5c6sd21-jna-5.10.0/share/java/jna.jar
      DEBUG: Adding location to classpath: /nix/store/sm2n008sc1jrfv987yx7sysqa5c6sd21-jna-5.10.0/share/java/jna-platform.jar
      DEBUG: Using configuration:
      DEBUG: flyway.configFiles -> /nix/store/3zjd120k15dnnmc38da65nqry0zbc3qs-flyway.conf
      DEBUG: flyway.jarDirs -> /nix/store/3gw3hnplqm5q01563404z4vnfr6r456i-mariadb-connector-java-2.7.4/share/java/:/nix/store/sm2n008sc1jrfv987yx7sysqa5c6sd21-jna-5.10.0/share/java/
      DEBUG: flyway.locations -> filesystem:/nix/store/rrf7v6zqzarsxlkfndlsdg1zjxd4fawk-sql-migrations
      DEBUG: flyway.url -> jdbc:mariadb:///somedb?localSocket=/run/mysqld/mysqld.sock
      DEBUG: flyway.user -> myuser
      DEBUG: flyway.validateMigrationNaming -> true
      DEBUG: flyway.validateOnMigrate -> true
      DEBUG: Scanning for classpath resources at 'classpath:db/callback' ...
      DEBUG: Determining location urls for classpath:db/callback using ClassLoader java.net.URLClassLoader@108c4c35 ...
      DEBUG: Unable to resolve location classpath:db/callback.
      Flyway Community Edition 7.5.4 by Redgate
      DEBUG: AWS SDK available: false
      DEBUG: Google Cloud Storage available: false
      DEBUG: Scanning for filesystem resources at '/nix/store/rrf7v6zqzarsxlkfndlsdg1zjxd4fawk-sql-migrations'
      DEBUG: Scanning for resources in path: /nix/store/rrf7v6zqzarsxlkfndlsdg1zjxd4fawk-sql-migrations (/nix/store/rrf7v6zqzarsxlkfndlsdg1zjxd4fawk-sql-migrations)
      DEBUG: Found filesystem resource: /nix/store/rrf7v6zqzarsxlkfndlsdg1zjxd4fawk-sql-migrations/V1__Initial_Schema.sql
      DEBUG: Validating V1__Initial_Schema.sql
      ERROR: Unexpected error
      java.lang.NullPointerException: Cannot invoke "org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(String, String, int)" because "this.exceptionFactory" is null
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.cmdPrologue(AbstractQueryProtocol.java:1926)
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:249)
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getAutoIncrementIncrement(AbstractQueryProtocol.java:1624)
        at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:353)
        at org.mariadb.jdbc.MariaDbStatement.executeUpdate(MariaDbStatement.java:625)
        at org.mariadb.jdbc.MariaDbConnection.setAutoCommit(MariaDbConnection.java:707)
        at org.flywaydb.core.internal.jdbc.DriverDataSource.getConnectionFromDriver(DriverDataSource.java:329)
        at org.flywaydb.core.internal.jdbc.DriverDataSource.getConnection(DriverDataSource.java:289)
        at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:59)
        at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:69)
        at org.flywaydb.core.Flyway.execute(Flyway.java:507)
        at org.flywaydb.core.Flyway.migrate(Flyway.java:165)
        at org.flywaydb.commandline.Main.executeOperation(Main.java:223)
        at org.flywaydb.commandline.Main.main(Main.java:144)
      

        Attachments

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            jojo Johannes Spangenberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.