Command execution error: Bean named 'sessionFactory' is expected to be of type 'org.springframework.beans.factory.FactoryBean' but was actually of type 'org.hibernate.internal.SessionFactoryImpl'
Appears to be the same as #81 but with grails 3.3.8, plugin 2.0.0, hibernate4, gorm version 6.1.8.
Shouldn't that combination work?
Steps to Reproduce
-
grails dbm-gorm-diff
Expected Behaviour
Diff produced
Actual Behaviour
Command execution error: Bean named 'sessionFactory' is expected to be of type 'org.springframework.beans.factory.FactoryBean' but was actually of type 'org.hibernate.internal.SessionFactoryImpl'
Environment Information
- Operating System: RHEL7.5
- Grails Version: 3.3.8
- Plugin Version: 2.0.0
- Database: Postgres 9.6
- JDK Version: 1.8.0_181-b25
Example Application
Can supply if required.
Please upload an example project
https://github.com/jameskhedley/test151
It's just a fresh app $ grails create-app test151 --profile=web, then change the dependencies for hibernate5 to hibernate4, then add the plugin, then a single domain class.
The only other thing I did was change Gorm version to 6.1.8 instead of 6.1.10 in gradle.properties
Adding specific liquibase doesn't help either, as per docs:
compile 'org.liquibase:liquibase-core:3.5.3'
@jameskleeh anything yet? If migration plugin is broken for grails 3, would halt our migration project. Suspect I'm doing something wrong though...
Surely plugin version 2.0.0? Current is 3.0.4
@robertoschwald yes it says plugin version 2.0.0, which is the version that is supposed to work with hibernate4? As per https://github.com/grails-plugins/grails-database-migration#versions
As far as I can see, plugin v1.4 works ok with grails 2.x and hibernate3 (and hibernate4 i think) but plugin v2.0.0 doesn't work with grails 3.x and hibernate4... like at all.
Not sure if 2.0.0 works with Grails 3.3.x. Can you try Hibernate 5 and 3.0.4?
Using grails 3.3.8, hibernate5 and plugin v3.0.3 fails with a different error (see below).
Is there a version of grails 3.x that you would expect to work with 2.0.0 and hibernate 4? Not sure what the point of that branch is otherwise.
$ grails dbm-status
:compileJava NO-SOURCE
:compileGroovy UP-TO-DATE
:buildProperties
:processResources UP-TO-DATE
:classes UP-TO-DATE
:findMainClass
:dbmStatus
INFO 30/11/18 17:38: liquibase: Can not use class org.grails.plugins.databasemigration.liquibase.GormDatabase as a Liquibase service because it does not have a no-argument constructor
Command execution error: java.lang.IllegalArgumentException: Script text to compile cannot be null!
:dbmStatus FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dbmStatus'.
> Process 'command '/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el7_5.x86_64/bin/java'' 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.
BUILD FAILED
Total time: 13.366 secs
| Error Command [dbm-status] error: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.5-bin.zip'. (Use --stacktrace to see the full trace)
The error you see in 3.0.3 was fixed in 3.0.4. You need to use this version.
Good spot and thanks for help so far.
Actually i tried it with 3.0.4 and got the same error - but only with dbm-status - dbm-gorm-diff worked! I think dbm-status may be broken? Error message was:
Command execution error: java.lang.IllegalArgumentException: Script text to compile cannot be null!
Also I was thrown off by the "no-argument" non-error.
I still think 2.0.0 is broken unless someone can say what versions of hibernate4 and grails it works with. In reality I think we'll probably try hibernate5 with our project and hope that doesn't break anything too badly.