grailsliquibasegrails-4

Error when running dbm-gorm-diff with Grails 4.0.10 and MySQL 8


When running dbm-gorm-diff I am getting the following error:

C:\Users\User\.jdks\corretto-1.8.0_332\bin\java.exe -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:CICompilerCount=3 -Djline.WindowsTerminal.directConsole=false -Dfile.encoding=UTF-8 -classpath C:\Users\User\AppData\Local\Temp\classpath380135322.jar org.grails.cli.GrailsCli dbm-gorm-diff --plain-output
> Task :compileJava NO-SOURCE
> Task :compileGroovy UP-TO-DATE
> Task :buildProperties UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :findMainClass
> Task :pathingJarCommand UP-TO-DATE

> Task :dbmGormDiff
2023-05-02 11:52:02.797  INFO --- [           main] i.m.context.env.DefaultEnvironment       : Established active environments: [development]
2023-05-02 11:52:03.113  INFO --- [           main] grails.boot.GrailsApp                    : Started Micronaut Parent Application Context in 367ms
2023-05-02 11:52:03.133  INFO --- [           main] .c.GrailsApplicationContextCommandRunner : The following profiles are active: development
2023-05-02 11:52:07.860  INFO --- [           main] g.p.s.SpringSecurityCoreGrailsPlugin     : 
Configuring Spring Security Core ...

Configuring Spring Security Core ...
2023-05-02 11:52:07.938  INFO --- [           main] g.p.s.SpringSecurityCoreGrailsPlugin     : ... finished configuring Spring Security Core

... finished configuring Spring Security Core

2023-05-02 11:52:08.761  INFO --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2023-05-02 11:52:08.765  WARN --- [           main] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2023-05-02 11:52:09.274  INFO --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2023-05-02 11:52:10.538  INFO --- [           main] o.g.o.hibernate.cfg.GrailsDomainBinder   : Mapping joined-subclass: com.runnercard.registration.RaceRegistration -> race_registration
2023-05-02 11:52:10.545  INFO --- [           main] o.g.o.hibernate.cfg.GrailsDomainBinder   : Mapping joined-subclass: com.runnercard.invoice.SaleInvoice -> sale_invoice
2023-05-02 11:52:10.545  INFO --- [           main] o.g.o.hibernate.cfg.GrailsDomainBinder   : Mapping joined-subclass: com.runnercard.invoice.CompositeEventInvoice -> composite_event_invoice
2023-05-02 11:52:10.546  INFO --- [           main] o.g.o.hibernate.cfg.GrailsDomainBinder   : Mapping joined-subclass: com.runnercard.invoice.RefundInvoice -> refund_invoice
2023-05-02 11:52:10.832  WARN --- [           main] n.s.ehcache.config.ConfigurationFactory  : No configuration found. Configuring ehcache from ehcache-failsafe.xml  found in the classpath: jar:file:/C:/Users/User/.gradle/caches/modules-2/files-2.1/net.sf.ehcache/ehcache/2.10.6/38076997b10f5c762a210ea8b9f6099da35ac5f/ehcache-2.10.6.jar!/ehcache-failsafe.xml
2023-05-02 11:52:14.865  INFO --- [           main] org.quartz.impl.StdSchedulerFactory      : Using default implementation for ThreadExecutor
2023-05-02 11:52:14.877  INFO --- [           main] org.quartz.core.SchedulerSignalerImpl    : Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2023-05-02 11:52:14.877  INFO --- [           main] org.quartz.core.QuartzScheduler          : Quartz Scheduler v.2.2.1 created.
2023-05-02 11:52:14.878  INFO --- [           main] org.quartz.simpl.RAMJobStore             : RAMJobStore initialized.
2023-05-02 11:52:14.878  INFO --- [           main] org.quartz.core.QuartzScheduler          : Scheduler meta-data: Quartz Scheduler (v2.2.1) 'quartzScheduler' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
  Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

2023-05-02 11:52:14.878  INFO --- [           main] org.quartz.impl.StdSchedulerFactory      : Quartz scheduler 'quartzScheduler' initialized from an externally provided properties instance.
2023-05-02 11:52:14.878  INFO --- [           main] org.quartz.impl.StdSchedulerFactory      : Quartz scheduler version: 2.2.1
2023-05-02 11:52:14.879  INFO --- [           main] org.quartz.core.QuartzScheduler          : JobFactory set to: grails.plugins.quartz.GrailsJobFactory@34602645
2023-05-02 11:52:15.590  WARN --- [           main] o.s.b.GenericTypeAwarePropertyDescriptor : Invalid JavaBean property 'exceptionMappings' being accessed! Ambiguous write methods found next to actually used [public void grails.plugin.springsecurity.web.authentication.AjaxAwareAuthenticationFailureHandler.setExceptionMappings(java.util.List)]: [public void org.springframework.security.web.authentication.ExceptionMappingAuthenticationFailureHandler.setExceptionMappings(java.util.Map)]
2023-05-02 11:52:15.925  INFO --- [           main] org.quartz.core.QuartzScheduler          : Scheduler quartzScheduler_$_NON_CLUSTERED started.
2023-05-02 11:52:15.929  WARN --- [           main] o.s.mock.web.MockServletContext          : Could not determine real path of resource class path resource [src/main/webapp/WEB-INF/sitemesh.xml]

java.io.FileNotFoundException: class path resource [src/main/webapp/WEB-INF/sitemesh.xml] cannot be resolved to URL because it does not exist
    at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195)
    at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:150)
    at org.springframework.mock.web.MockServletContext.getRealPath(MockServletContext.java:476)
    at org.grails.web.sitemesh.Grails5535Factory.<init>(Grails5535Factory.java:78)
    at org.grails.web.servlet.view.SitemeshLayoutViewResolver.loadSitemeshConfig(SitemeshLayoutViewResolver.java:105)
    at org.grails.web.servlet.view.SitemeshLayoutViewResolver.init(SitemeshLayoutViewResolver.java:67)
    at org.grails.web.servlet.view.SitemeshLayoutViewResolver.onApplicationEvent(SitemeshLayoutViewResolver.java:146)
    at org.grails.web.servlet.view.SitemeshLayoutViewResolver.onApplicationEvent(SitemeshLayoutViewResolver.java:42)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:897)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:99)
    at grails.ui.command.GrailsApplicationContextCommandRunner.run(GrailsApplicationContextCommandRunner.groovy:55)
    at grails.ui.command.GrailsApplicationContextCommandRunner.main(GrailsApplicationContextCommandRunner.groovy:102)

2023-05-02 11:52:16.049  INFO --- [           main] g.p.s.web.GrailsSecurityFilterChain      : Creating filter chain: Ant [pattern='/**'], [grails.plugin.springsecurity.web.SecurityRequestHolderFilter@27977de3, org.springframework.security.web.access.channel.ChannelProcessingFilter@309aae74, org.springframework.security.web.context.SecurityContextPersistenceFilter@b7b339d, grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter@40cc1f71, grails.plugin.springsecurity.web.authentication.GrailsUsernamePasswordAuthenticationFilter@68cd7f68, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@6b0137f2, grails.plugin.springsecurity.web.filter.GrailsRememberMeAuthenticationFilter@15817003, grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter@3022212, org.springframework.web.filter.FormContentFilter@1cc332ed, grails.plugin.springsecurity.web.UpdateRequestContextHolderExceptionTranslationFilter@bb6bd70, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@4b9adb3b, org.springframework.security.web.authentication.switchuser.SwitchUserFilter@3f8b925e]
2023-05-02 11:52:16.138  INFO --- [           main] org.quartz.core.QuartzScheduler          : Scheduler quartzScheduler_$_NON_CLUSTERED started.
2023-05-02 11:52:16.138  INFO --- [           main] quartz.QuartzGrailsPlugin                : Quartz Scheduler - Started
2023-05-02 11:52:16.144  INFO --- [           main] .c.GrailsApplicationContextCommandRunner : Started GrailsApplicationContextCommandRunner in 14.206 seconds (JVM running for 15.408)
2023-05-02 11:52:16.149  INFO --- [           main] grails.boot.GrailsApp                    : Application starting in environment: development
Grails application running at http://localhost:0/roadrace in environment: development
2023-05-02 11:52:16.372  INFO --- [           main] o.g.o.hibernate.cfg.GrailsDomainBinder   : Mapping joined-subclass: com.runnercard.registration.RaceRegistration -> race_registration
2023-05-02 11:52:16.378  INFO --- [           main] o.g.o.hibernate.cfg.GrailsDomainBinder   : Mapping joined-subclass: com.runnercard.invoice.SaleInvoice -> sale_invoice
2023-05-02 11:52:16.378  INFO --- [           main] o.g.o.hibernate.cfg.GrailsDomainBinder   : Mapping joined-subclass: com.runnercard.invoice.CompositeEventInvoice -> composite_event_invoice
2023-05-02 11:52:16.379  INFO --- [           main] o.g.o.hibernate.cfg.GrailsDomainBinder   : Mapping joined-subclass: com.runnercard.invoice.RefundInvoice -> refund_invoice
Command execution error: No signature of method: liquibase.database.DatabaseFactory.openDatabase() is applicable for argument types: (String, String, String, org.grails.config.NavigableMap$NullSafeNavigator...) values: [jdbc:mysql://localhost:3306/dev?useUnicode=yes&characterEncoding=UTF-8, ...]
Possible solutions: openDatabase(java.lang.String, java.lang.String, java.lang.String, java.lang.String, liquibase.resource.ResourceAccessor), openDatabase(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, liquibase.resource.ResourceAccessor)
2023-05-02 11:52:16.488  INFO --- [       Thread-7] org.quartz.core.QuartzScheduler          : Scheduler quartzScheduler_$_NON_CLUSTERED shutting down.
2023-05-02 11:52:16.488  INFO --- [       Thread-7] org.quartz.core.QuartzScheduler          : Scheduler quartzScheduler_$_NON_CLUSTERED paused.
2023-05-02 11:52:16.892  INFO --- [       Thread-7] org.quartz.core.QuartzScheduler          : Scheduler quartzScheduler_$_NON_CLUSTERED shutdown complete.
2023-05-02 11:52:16.907 DEBUG --- [       Thread-7] rcroadraceweb4.TomcatCustomizer          : Not attempting Tomcat Shutdown
2023-05-02 11:52:16.908  INFO --- [       Thread-7] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2023-05-02 11:52:16.915  INFO --- [       Thread-7] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

> Task :dbmGormDiff FAILED
6 actionable tasks: 2 executed, 4 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':dbmGormDiff'.
> Process 'command 'C:\Users\User\.jdks\corretto-1.8.0_332\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 18s
Error |
Command [dbm-gorm-diff] error: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-5.6.4-bin.zip'. (Use --stacktrace to see the full trace)

I am using Grails 4.0.10 and MySQL 8.

What is causing this error?


Solution

  • For anyone stumbling into this issue, my datasource block was incomplete.

    I had only put:

    dataSource:
        dbCreate: none
        url: jdbc:mysql://localhost:3306/dev?useUnicode=yes&characterEncoding=UTF-8
        username: root
        password: password
    

    I added missing properties and it worked.

    dataSource {
        pooled = true
        dbCreate = "none"
    
        url = "jdbc:mysql://localhost:3306/dev?useUnicode=yes&characterEncoding=UTF-8"
    
        driverClassName = "com.mysql.cj.jdbc.Driver"
    
        dialect = org.hibernate.dialect.MySQL8Dialect
    
        username = "root"
        password = "password"
    
        type = "com.zaxxer.hikari.HikariDataSource"
    
    }