Ubuntu 20.10 and MySQL 8.0.22: here's how to fix your code

Hello,
You need to fix your code on the next release of Subsonic for Ubunti in order to fix a JDBC issue with MySQL:
Running the latest version of Subsonic on the latest version of Ubuntu (20.10 as of this writing) and MySQL 8.0.22 using openjdk version 1.8.0_275 results in the following error:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL ''jdbc:mysql://127.0.0.1:3306/subsonic?user=****&password=****!&characterEncoding=UTF-8''
(here's the line from /etc/default/subsonic:
SUBSONIC_ARGS="--max-memory=200 --db='jdbc:mysql://127.0.0.1:3306/subsonic?user=****&password=****!&characterEncoding=UTF-8'" )
This will happen even through the MySQL drivers are loaded, regardless of which version they are:
>lsof | grep subsonic | grep mysql*
java 48717 root mem REG 253,0 990924 8926613 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-5.1.40.jar
java 48717 root mem REG 253,0 2389215 8913841 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-8.0.22.jar
java 48717 root 78r REG 253,0 2389215 8913841 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-8.0.22.jar
java 48717 root 90r REG 253,0 990924 8926613 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-5.1.40.jar
java 48717 48718 java root mem REG 253,0 990924 8926613 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-5.1.40.jar
java 48717 48718 java root mem REG 253,0 2389215 8913841 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-8.0.22.jar
(note that both jars are loaded. This error will occur no matter which jar version is loaded)
(also note: I tried both version in the pom.xml:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.22</version>
<scope>runtime</scope>
</dependency>
and it made no difference.)
This error is not resolvable via setting CLASSPATH or JAVA_HOME variables.
The cause of this appears to be that you're not including the correct class in your code. Please add the following line:
Class.forName("com.mysql.jdbc.Driver");
This should resolve the issue.
(incidentally, this issue is unique to Ubuntu. I tried the exact same configuration of Subsonic versions, mysql drivers, database version and jdk version on Centos and it worked perfectly)
(I like parentheses)
Thanks.
You need to fix your code on the next release of Subsonic for Ubunti in order to fix a JDBC issue with MySQL:
Running the latest version of Subsonic on the latest version of Ubuntu (20.10 as of this writing) and MySQL 8.0.22 using openjdk version 1.8.0_275 results in the following error:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL ''jdbc:mysql://127.0.0.1:3306/subsonic?user=****&password=****!&characterEncoding=UTF-8''
(here's the line from /etc/default/subsonic:
SUBSONIC_ARGS="--max-memory=200 --db='jdbc:mysql://127.0.0.1:3306/subsonic?user=****&password=****!&characterEncoding=UTF-8'" )
This will happen even through the MySQL drivers are loaded, regardless of which version they are:
>lsof | grep subsonic | grep mysql*
java 48717 root mem REG 253,0 990924 8926613 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-5.1.40.jar
java 48717 root mem REG 253,0 2389215 8913841 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-8.0.22.jar
java 48717 root 78r REG 253,0 2389215 8913841 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-8.0.22.jar
java 48717 root 90r REG 253,0 990924 8926613 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-5.1.40.jar
java 48717 48718 java root mem REG 253,0 990924 8926613 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-5.1.40.jar
java 48717 48718 java root mem REG 253,0 2389215 8913841 /var/subsonic/jetty/0cfa60/webapp/WEB-INF/lib/mysql-connector-java-8.0.22.jar
(note that both jars are loaded. This error will occur no matter which jar version is loaded)
(also note: I tried both version in the pom.xml:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.22</version>
<scope>runtime</scope>
</dependency>
and it made no difference.)
This error is not resolvable via setting CLASSPATH or JAVA_HOME variables.
The cause of this appears to be that you're not including the correct class in your code. Please add the following line:
Class.forName("com.mysql.jdbc.Driver");
This should resolve the issue.
(incidentally, this issue is unique to Ubuntu. I tried the exact same configuration of Subsonic versions, mysql drivers, database version and jdk version on Centos and it worked perfectly)
(I like parentheses)
Thanks.