Cannot find database driver: com.mysql.jdbc.Driver

Hi all,

I’ve got the following setup in my project, but I’m unable to use

  • [INFO] — liquibase-maven-plugin:2.0.1:update (update) @ vem-client —
    [DEBUG] org.liquibase:liquibase-maven-plugin:jar:2.0.1:
    [DEBUG]    mysql:mysql-connector-java:jar:5.1.16:runtime
    [DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0:compile
    [DEBUG]    org.apache.maven:maven-project:jar:2.0:compile
    [DEBUG]       org.apache.maven:maven-profile:jar:2.0:compile
    [DEBUG]       org.apache.maven:maven-model:jar:2.0:compile
    [DEBUG]       org.apache.maven:maven-artifact-manager:jar:2.0:compile
    [DEBUG]          org.apache.maven:maven-repository-metadata:jar:2.0:compile
    [DEBUG]       org.codehaus.plexus:plexus-utils:jar:1.0.4:compile
    [DEBUG]       org.apache.maven:maven-artifact:jar:2.0:compile
    [DEBUG]       org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-8:compile
    [DEBUG]          junit:junit:jar:4.8.1:test (scope managed from compile) (version managed from 3.8.1)
    [DEBUG]          classworlds:classworlds:jar:1.1-alpha-2:compile
    [DEBUG]    org.liquibase:liquibase-core:jar:2.0.1:compile
    [DEBUG] Created new class realm plugin>org.liquibase:liquibase-maven-plugin:2.0.1
    [DEBUG] Importing foreign packages into class realm plugin>org.liquibase:liquibase-maven-plugin:2.0.1
    [DEBUG]   Imported:  < maven.api
    [DEBUG] Populating class realm plugin>org.liquibase:liquibase-maven-plugin:2.0.1
    [DEBUG]   Included: org.liquibase:liquibase-maven-plugin:jar:2.0.1
    [DEBUG]   Included: mysql:mysql-connector-java:jar:5.1.16
    [DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:1.0.4
    [DEBUG]   Included: org.liquibase:liquibase-core:jar:2.0.1
    [DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0
    [DEBUG]   Excluded: org.apache.maven:maven-project:jar:2.0
    [DEBUG]   Excluded: org.apache.maven:maven-profile:jar:2.0
    [DEBUG]   Excluded: org.apache.maven:maven-model:jar:2.0
    [DEBUG]   Excluded: org.apache.maven:maven-artifact-manager:jar:2.0
    [DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:2.0
    [DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:2.0
    [DEBUG]   Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-8
    [DEBUG]   Excluded: junit:junit:jar:4.8.1
    [DEBUG]   Excluded: classworlds:classworlds:jar:1.1-alpha-2
    [DEBUG] Configuring mojo org.liquibase:liquibase-maven-plugin:2.0.1:update from plugin realm ClassRealm[plugin>org.liquibase:liquibase-maven-plugin:2.0.1, parent: sun.misc.Launcher$AppClassLoader@3326b249]
    [DEBUG] Configuring mojo ‘org.liquibase:liquibase-maven-plugin:2.0.1:update’ with basic configurator -->
    [DEBUG]   (f) changesToApply = 0
    [DEBUG]   (f) clearCheckSums = false
    [DEBUG]   (f) dropFirst = false
    [DEBUG]   (f) emptyPassword = false
    [DEBUG]   (f) includeArtifact = true
    [DEBUG]   (f) includeTestOutputDirectory = true
    [DEBUG]   (f) logging = INFO
    [DEBUG]   (f) project = MavenProject: com.company.client:the-client:1.0-SNAPSHOT @ /Users/…/trunk/client/pom.xml
    [DEBUG]   (f) promptOnNonLocalDatabase = true
    [DEBUG]   (f) propertyFile = target/classes/liquibase.properties
    [DEBUG]   (f) propertyFileWillOverride = true
    [DEBUG]   (f) verbose = false
    [DEBUG] – end configuration –
    [INFO] ------------------------------------------------------------------------
    [INFO] Parsing Liquibase Properties File
    [INFO]   File: target/classes/liquibase.properties
    [DEBUG]   properties file setting value: changeLogFile
    [DEBUG]   properties file setting value: verbose
    [DEBUG]   properties file setting value: password
    [DEBUG]   properties file setting value: url
    [DEBUG]   properties file setting value: driver
    [DEBUG]   properties file setting value: dropFirst
    [DEBUG]   properties file setting value: username
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3.157s
    [INFO] Finished at: Fri May 06 02:52:11 PDT 2011
    [INFO] Final Memory: 5M/81M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:2.0.1:update (update) on project vem-client: Error setting up or running Liquibase: java.lang.RuntimeException: Cannot find database driver: com.mysql.jdbc.Driver -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:2.0.1:update (update) on project vem-client: Error setting up or running Liquibase: java.lang.RuntimeException: Cannot find database driver: com.mysql.jdbc.Driver
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    Caused by: org.apache.maven.plugin.MojoExecutionException: Error setting up or running Liquibase: java.lang.RuntimeException: Cannot find database driver: com.mysql.jdbc.Driver
        at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:306)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        … 19 more
    Caused by: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: com.mysql.jdbc.Driver
        at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:111)
        at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:260)
        … 21 more
    Caused by: java.lang.RuntimeException: Cannot find database driver: com.mysql.jdbc.Driver
        at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:70)
        … 22 more
    [ERROR]
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
  • Does anybody have an idea what I’m doing wrong here?

    Thanks

    it seems the artifact with driver is not loaded at boot maven.

    try to add a section


    1.        


    I’m adding this on the the parent pom. And now I can not explain now why it does work on my workstation, but not dependencies section you described 8)