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:
Class.forName(“com.mysql.jdbc.Driver”);
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
run_integration_tests:
docker:
- image: circleci/openjdk:8u151-jdk-node-browsers
environment:
- MYSQL_DATABASE: "rbp"
- MYSQL_HOST: "127.0.0.1"
- image: circleci/mysql:5.7
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD: 'password'
environment:
MAVEN_OPTS: -Xmx3200m
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
command: |
dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
mysql -h 127.0.0.1 -u root -ppassword < db/setup.sql
- run:
command: mvn integration-test
working_directory: integration-tests