Missing JDBC Driver

Hello all,

New to CircleCI but enjoying working with it so far. However, I have run into an issue with my Java API when it starts up for integration testing. During its initialisation, the API connects to a MySQL DB but every time I start it up I am getting this error:

Failed to instantiate [api.BookingController]: Constructor threw exception; nested exception is java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

I’ve tried adding the following to kick start things:


Which returns the error you see above. I have also run:

sudo apt-get install libmysql-java

Neither of these things fixed the issue. I have also confirmed that the DB is accessible with mysql-client. Can anyone help, feel like I am missing something obvious.

CircleCi config below


  - image: circleci/openjdk:8u151-jdk-node-browsers
      - MYSQL_DATABASE: "rbp"
      - MYSQL_HOST: ""
  - image: circleci/mysql:5.7
      MYSQL_ROOT_PASSWORD: 'password'

    MAVEN_OPTS: -Xmx3200m

  - restore_cache:
      key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}

  - run:
      command: |
        dockerize -wait tcp:// -timeout 120s
        mysql -h -u root -ppassword < db/setup.sql

  - run:
      command: mvn integration-test
      working_directory: integration-tests

It does not seem to be in your config file, though?

Apologies, that was run during an SSH session to test it out.

I worked out the issue isn’t CircleCI related though and that the way I was starting the API within my integration tests was what was causing the issue. So I moved the startup of the APIs to a shell script and it all worked fine and dandy :slight_smile:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.