I've been spending the last couple of days just trying to get a barebones version of a Grails project to run. After moving through various problems dealing with Java version incompatibilities and buggy IDEs I can see the home stretch! But this last problem has me vexed.
My grails 2.4.4 project is using H2 and I'm running the application in Dev mode. I get a bunch of error messages like this:
Error | 2015-09-27 00:22:16,096 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - Table "ORDER_DELIVERY" not found; SQL statement: alter table order_delivery drop constraint FK_syi9a9vft4d15lq78cx3e1m38 if exists [42102-176]
I thought maybe these errors were related to this: Grails 2.4 and hibernate4 errors with run-app and that I could just ignore them. But when I got the dbconsole of my app it show no tables whatsoever. With that being said it seemed to be the problem described in this question:
Grails throws Table "xxx" not found
But I tried the accepted solution of using disk space and that has not solved the problem. Any ideas? I'm using Spring Security and Spring security with rest though disabling it hasn't helped.
from my Datasource.groovy:
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:C:/temp/app_data;MVCC=TRUE"
}
}
}
My bootstrap class. SecUser and SecRole were generated by the s2 quickstart script, and my User domain extends SecUser. The User.findAll() command returns an empty list:
class BootStrap {
def init = { servletContext ->
User user = new User(username: "test", password: "test123",
email: "test@guy.com", name: "Dakota Roberts", title: "MD", active: true)
user.save()
SecRole roleUser = new SecRole(authority: "ROLE_USER")
roleUser.save()
new SecUserSecRole(user: user, role: roleUser).save()
def users = User.findAll()
for(User chkUser : users) {
println chkUser.name
}
}
def destroy = {
}
}
User domain class example. It extends SecUser which sets tablePerHierarchy to false:
@Resource(uri="/user")
class User extends SecUser {
String email
String name
String title
Boolean active
static belongsTo = [organization : Organization]
static constraints = {
email email: true, unique: true, blank: false
name blank: false
}
}