How to configure mongodb with grails - mongodb

I am new on this way.I tried to much still i am getting error to make login application using mongodb with grails.
grails 2.4.0
mongodb 3.0.3
BuildConfig.groovy.
grails.servlet.version = "3.0" // Change depending on target container
compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.work.dir = "target/work"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.fork = [
// configure settings for compilation JVM, note that if you alter the
Groovy version forked compilation is required
// compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256,
daemon:true],
// configure settings for the test-app JVM, uses the daemon by default
test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256,
daemon:true],
// configure settings for the run-app JVM
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256,
forkReserve:false],
// configure settings for the run-war JVM
war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256,
forkReserve:false],
// configure settings for the Console UI JVM
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to
disable ehcache:
// excludes 'ehcache'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info',
'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin
installation, not advised and here for backwards compatibility
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
// uncomment these (or add new ones) to enable remote dependency
resolution from public Maven repositories
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime',
'test' or 'provided' scopes e.g.
// runtime 'mysql:mysql-connector-java:5.1.29'
// runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
compile "org.springframework:spring-orm:$springVersion"
compile 'org.grails:grails-datastore-gorm:3.1.4.RELEASE'
compile 'org.grails:grails-datastore-core:3.1.4.RELEASE'
test 'org.grails:grails-datastore-simple:3.1.4.RELEASE'
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.53"
// plugins for the compile step
compile ":scaffolding:2.1.0"
compile ':cache:1.1.6'
compile ":asset-pipeline:1.8.7"
// plugins needed at runtime but not for compilation
// runtime ":hibernate4:4.3.5.3" // or ":hibernate:3.6.10.15"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
// Uncomment these to enable additional asset-pipeline capabilities
//compile ":sass-asset-pipeline:1.7.4"
//compile ":less-asset-pipeline:1.7.0"
//compile ":coffee-asset-pipeline:1.7.0"
//compile ":handlebars-asset-pipeline:1.3.0.3"
compile ":mongodb:3.0.3"
}
}
DataSource.groovy
dataSource {
pooled = true
jmxExport = true
driverClassName = "org.h2.Driver"
username = "sa"
password = ""
}
grails {
mongo {
host = "localhost"
port = 27017
username = "admin"
password = "admin"
databaseName = "mydb"
}
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
// cache.region.factory_class =
'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
cache.region.factory_class =
'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
singleSession = true // configure OSIV singleSession mode
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop',
'update', 'validate', ''
url =
"jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
}
}
test {
dataSource {
dbCreate = "update"
url =
"jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
}
}
production {
dataSource {
dbCreate = "update"
url =
"jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
properties {
// See http://grails.org/doc/latest/guide/conf.html#dataSource
//for documentation
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors = "ConnectionState"
defaultTransactionIsolation =
java.sql.Connection.TRANSACTION_READ_COMMITTED
}
}
}
}
Error while run this application i spent more time two solve it but i think it would be version compatibility issue.
Error | 2015-05-09 11:50:58,502 [localhost-startStop-1] ERROR
context.GrailsContextLoaderListener - Error initializing the application:
Error creating bean with name 'transactionManagerPostProcessor':
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'transactionManager': Cannot resolve reference to bean
'mongoTransactionManager' while setting constructor argument with key [1];
nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'mongoTransactionManager': Cannot resolve reference to bean
'mongoDatastore' while setting bean property 'datastore'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'mongoDatastore': Cannot resolve reference to bean
'mongoBean' while setting bean property 'mongo'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'mongo': Invocation of init method failed; nested exception
is com.mongodb.MongoTimeoutException: Timed out while waiting for a server
that matches AnyServerSelector{} after 10000 ms
Message: Error creating bean with name 'transactionManagerPostProcessor':
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'transactionManager': Cannot resolve reference to bean
'mongoTransactionManager' while setting constructor argument with key [1];
nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'mongoTransactionManager': Cannot resolve reference to bean
'mongoDatastore' while setting bean property 'datastore'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'mongoDatastore': Cannot resolve reference to bean
'mongoBean' while setting bean property 'mongo'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'mongo': Invocation of init method failed; nested exception
is com.mongodb.MongoTimeoutException: Timed out while waiting for a server
that matches AnyServerSelector{} after 10000 ms

Seems like your MongoDB server is not running into your local machine. Please confirm and start the service.
For Ubuntu:
sudo service mongod start
Or for other operating systems, follow this http://docs.mongodb.org/manual/installation/

Related

Can't install and use Jhipster Registry 7.4.0 because hazelcast and logs properties are left bound

I try to use Jhipster Registry 7.4.0 for my new application. At this time, I just want to start it in default configuration.
In my application and application-dev properties files, I have (in both files):
...
jhipster:
async:
core-pool-size: 2
max-pool-size: 50
queue-capacity: 10000
cache:
hazelcast:
time-to-live-seconds: 3600
backup-count: 1
management-center:
enabled: false
update-interval: 3
url: http://localhost:8180/mancenter
security:
authentication:
jwt:
base64-secret: <MY KEY>
metrics:
logs:
enabled: false
report-frequency: 60
...
When I start my registry, it's failed because logs and hazelcast are left bound :
2022-11-17T11:42:40.901+01:00 INFO 11900 --- [ main] t.jhipster.registry.JHipsterRegistryApp : The following 4 profiles are active: "composite", "dev", "api-docs", "swagger"
2022-11-17T11:42:44.401+01:00 WARN 11900 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'undertowServletWebServerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedUndertow.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webConfigurer' defined in URL [jar:file:/C:/Users/myuser/Desktop/JHIPSTER_REGISTRY-7.4.0/jhipster-registry-7.4.0.jar!/BOOT-INF/classes!/tech/jhipster/registry/config/WebConfigurer.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'jhipster-tech.jhipster.config.JHipsterProperties': Could not bind properties to 'JHipsterProperties' : prefix=jhipster, ignoreInvalidFields=false, ignoreUnknownFields=false; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'jhipster' to tech.jhipster.config.JHipsterProperties
2022-11-17T11:42:44.489+01:00 ERROR 11900 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : ____***************************__APPLICATION FAILED TO START__***************************____Description:____Binding to target [Bindable#9a2ec9b type = tech.jhipster.config.JHipsterProperties, value = 'provided', annotations = array<Annotation>[#org.springframework.boot.context.properties.ConfigurationProperties(ignoreInvalidFields=false, ignoreUnknownFields=false, prefix="jhipster", value="jhipster")]] failed:____ Property: jhipster.metrics.logs.enabled__ Value: "false"__ Origin: URL [file:config/application-dev.yml] - 88:22__ Reason: The elements [jhipster.metrics.logs.enabled,jhipster.metrics.logs.report-frequency] were left unbound.__ Property: jhipster.metrics.logs.report-frequency__ Value: "60"__ Origin: URL [file:config/application-dev.yml] - 89:31__ Reason: The elements [jhipster.metrics.logs.enabled,jhipster.metrics.logs.report-frequency] were left unbound.____Action:____Update your application's configuration__
Do you know why this properties ar not found ? I havec check sample on gitub registry depo ans configuration seems to be identical ...

How do i disable elastic search and fall back to local filesystem storage in hibernate search 6

I am using Hibernate 6 with Amazons opensearch server in production. When i'm testing locally i don't want to use the opensearch server, instead i want to use local-filesystem to store the index files.
However i can't hibernate search to use local-filesystem even when i explicitly set it with jpaProperties.put("hibernate.search.backend.directory.type", "local-filesystem"); while at the same time not setting the property hibernate.search.backend.uris. Before all the hibernate search properties can be programmatically set i get the following error on startup:
default backend:
failures:
- HSEARCH400080: Unable to detect the Elasticsearch version running on the cluster: HSEARCH400007: Elasticsearch request failed: Connection refused: no further information
Request: GET with parameters {}
I have the following maven dependencies:
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm</artifactId>
<version>6.1.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-backend-elasticsearch-aws</artifactId>
<version>6.1.5.Final</version>
</dependency>
The following sets hibernate search and the lucene file destination path if using lucene only:
private Properties initializeJpaProperties() {
String luceneAbsoluteFilePath = useExternalElasticSearchServer ? null : setDefaultLuceneIndexBaseFilePath(); //Alleen relevant wanneer je geen elastic search gebruikt.
Properties jpaProperties = new Properties();
//---------------------------open search aws related-----------------------------------
if(useExternalElasticSearchServer) {
jpaProperties.put("hibernate.search.backend.aws.credentials.type", "static");
jpaProperties.put("hibernate.search.backend.aws.credentials.access_key_id", awsId);
jpaProperties.put("hibernate.search.backend.aws.credentials.secret_access_key", awsKey);
jpaProperties.put("hibernate.search.backend.aws.region", openSearchAwsInstanceRegion);
jpaProperties.put("hibernate.search.backend.aws.signing.enabled", true);
jpaProperties.put("hibernate.search.backend.uris", elasticSearchHostAddress);
}
//--------------------------------------------------------------------------------------------
jpaProperties.put("hibernate.search.automatic_indexing.synchronization.strategy", indexSynchronizationStrategy);
jpaProperties.put("hibernate.search.backend.request_timeout", requestTimeout);
jpaProperties.put("hibernate.search.backend.connection_timeout", elasticSearchConnectionTimeout);
jpaProperties.put("hibernate.search.backend.read_timeout", readTimeout);
jpaProperties.put("hibernate.search.backend.max_connections", maximumElasticSearchConnections);
jpaProperties.put("hibernate.search.backend.max_connections_per_route", maximumElasticSearchConnectionsPerRout);
// jpaProperties.put("hibernate.search.schema_management.strategy", schemaManagementStrategy);
jpaProperties.put("hibernate.search.backend.thread_pool.size", maxPoolSize);
jpaProperties.put("hibernate.search.backend.analysis.configurer", "class:config.EnhancedLuceneAnalysisConfig");
// jpaProperties.put("hibernate.search.backend.username", hibernateSearchUsername); //Alleen voor wanneer je elastic search lokaal draait
// jpaProperties.put("hibernate.search.backend.password", hibernateSearchPassword);
if(!useExternalElasticSearchServer) {
jpaProperties.put("hibernate.search.backend.directory.type", "local-filesystem");
jpaProperties.put("hibernate.search.backend.directory.root", luceneAbsoluteFilePath);
jpaProperties.put("hibernate.search.backend.lucene_version", "LUCENE_CURRENT");
jpaProperties.put("hibernate.search.backend.io.writer.infostream", true);
}
jpaProperties.put("hibernate.jdbc.batch_size", defaultBatchSize);
jpaProperties.put("spring.jpa.properties.hibernate.jdbc.batch_size", defaultBatchSize);
jpaProperties.put("hibernate.order_inserts", "true");
jpaProperties.put("hibernate.order_updates", "true");
jpaProperties.put("hibernate.batch_versioned_data", "true");
// log.info("The directory of the lucene index files is set to {}", luceneAbsoluteFilePath);
return jpaProperties;
}
private String setDefaultLuceneIndexBaseFilePath() {
String luceneRelativeFilePath = ServiceUtil.getOperatingSystemCompatiblePath("/data/lucene/indexes/default");
StringBuilder luceneAbsoluteFilePath = new StringBuilder(System.getProperty("user.dir"));
if(!StringUtils.isEmpty(luceneIndexBase)) {
luceneRelativeFilePath = ServiceUtil.getOperatingSystemCompatiblePath(luceneIndexBase);
String OSPathSeparator = ServiceUtil.getOperatingSystemFileSeparator();
if(luceneRelativeFilePath.toCharArray()[0] != OSPathSeparator.charAt(0))
luceneAbsoluteFilePath.append(OSPathSeparator);
luceneAbsoluteFilePath.append(luceneRelativeFilePath);
validateUserDefinedAbsolutePath(luceneRelativeFilePath);
}
else{
log.warn("No relative path value for property 'lucene-index-base' was found in application.properties, will use the default path '{}' instead.", luceneRelativeFilePath);
luceneAbsoluteFilePath.append(luceneRelativeFilePath);
}
return luceneAbsoluteFilePath.toString();
}
I know that i can disable hibernate search completely with hibernate.search.enabled set to false but i don't want that. I want to be able to switch to lucene only without having to remove all the ElasticSearch/OpenSearch dependencies from my POM.xml beforehand. How do i do this?
EDIT: I just found out that you can set the backend type with hibernate.search.backend.type. This setting is set to the value elasticsearch by default. I should also be able to set this value to lucene but when i do that i get the following error:
default backend:
failures:
- HSEARCH000501: Invalid value for configuration property 'hibernate.search.backend.type': 'lucene'. HSEARCH000579: Unable to resolve bean reference to type 'org.hibernate.search.engine.backend.spi.BackendFactory' and name 'lucene'. Failed to resolve bean from Hibernate Search's internal registry with exception: HSEARCH000578: No beans defined for type 'org.hibernate.search.engine.backend.spi.BackendFactory' and name 'lucene' in Hibernate Search's internal registry. Failed to resolve bean from bean manager with exception: HSEARCH000590: No configured bean manager. Failed to resolve bean from bean manager with exception: HSEARCH000591: Unable to resolve 'lucene' to a class extending 'org.hibernate.search.engine.backend.spi.BackendFactory': HSEARCH000530: Unable to load class 'lucene': Could not load requested class : lucene Failed to resolve bean using reflection with exception: HSEARCH000591: Unable to resolve 'lucene' to a class extending
'org.hibernate.search.engine.backend.spi.BackendFactory': HSEARCH000530: Unable to load class 'lucene': Could not load requested class : lucene
EDIT 2:
I tried the setting the following settings with no success as well.
jpaProperties.put("hibernate.search.default_backend", "lucene");
jpaProperties.put("hibernate.search.backends.lucene.type", "lucene");
jpaProperties.put("hibernate.search.backend.type", "lucene");
You need to set the backend type explicitly according to the environment:
jpaProperties.put("hibernate.search.backend.type", isProductionEnvironment() ? "elasticsearch" : "lucene");
And you also need to have the Lucene backend in your classpath:
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-backend-lucene</artifactId>
<version>${my-hibernate-search-version}</version>
</dependency>

Problems connecting to Postgres from Grails

I have verified that I can connect to the postgres database using a Java test program. I have also verified that I can connect using a little Grails testDB project. But when I try to run my larger project, which the same BuildConfig.groovy, it fails.
I've tried different jdbc versions (e.g., 4 rather than 41) in the postgres jar, but it didn't help.
I've been searching stackoverflow and anything else I can find to no avail (e.g., "help me stackoverflow, your my only hope").
My BuildConfig.groovy file is shown below:
grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.work.dir = "target/work"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.fork = [
// configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
// compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the test-app JVM, uses the daemon by default
test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the run-app JVM
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the run-war JVM
war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the Console UI JVM
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
// runtime 'mysql:mysql-connector-java:5.1.29'
compile 'org.postgresql:postgresql:9.3-1101-jdbc41'
runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
test "org.grails:grails-datastore-test-support:1.0-grails-2.4"
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.55"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.7'
compile ":asset-pipeline:1.9.6"
compile ":twitter-bootstrap:3.2.1"
// compile ":jquery-dialog:2.0.3"
// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.5.5" // or ":hibernate:3.6.10.15"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
runtime ":twitter-bootstrap:3.2.1"
}
}
My DataSource.groovy file contains
dataSource {
pooled = true
jmxExport = true
url = "jdbc:postgresql://150.18.178.9:5432/myDB"
driverClassName = "org.postgresql.Driver"
dbCreate = "update"
username = "user"
password = "password"
dialect = net.sf.hibernate.dialect.PostgreSQLDialect
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
// cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
singleSession = true // configure OSIV singleSession mode
}
// environment specific settings
environments {
development {
dataSource { // database dev
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
url="jdbc:postgresql://150.18.178.9:5432/dev"
username = "user"
password = "password"
}
}
test {
dataSource {
dbCreate = "update"
url="jdbc:postgresql://150.18.178.9:5432/test"
username = "user"
password = "password"
}
}
production {
dataSource {
dbCreate = "update"
url="jdbc:postgresql://150.18.178.9:5432/myDB"
username = "user"
password = "password"
properties {
// See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors = "ConnectionState"
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
}
}
}
When I try to run my application I get:
/usr/java/latest/bin/java -Dgrails.home=/home/iank/software/grails/latest -Dbase.dir=/home/iank/IdeaProjects/nderground -Dtools.jar=/usr/java/latest/lib/tools.jar -Dgroovy.starter.conf=/home/iank/software/grails/latest/conf/groovy-starter.conf -Xmx768M -Xms768M -XX:MaxPermSize=256m -XX:PermSize=256m -javaagent:/home/iank/software/grails/latest/lib/org.springframework/springloaded/jars/springloaded-1.2.0.RELEASE.jar -noverify -Dspringloaded=profile=grails -Didea.launcher.port=7535 -Didea.launcher.bin.path=/home/iank/software/idea-IU-135.909/bin -Dfile.encoding=UTF-8 -classpath /home/iank/software/grails/latest/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.3.6.jar:/home/iank/software/grails/latest/dist/grails-bootstrap-2.4.3.jar:/home/iank/software/idea-IU-135.909/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf /home/iank/software/grails/latest/conf/groovy-starter.conf "run-app -plain-output"
|Loading Grails 2.4.3
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
...........
|Compiling 1 source files
............................
|Running Grails application
| Error 2014-09-27 17:16:38,021 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
Line | Method
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by IllegalArgumentException: object is not an instance of declaring class
->> 22 | doCall in nderground.User$__clinit__closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . in java.lang.Thread
Error |
Forked Grails VM exited with error
|Server running. Browse to http://localhost:8080/nderground
Process finished with exit code 1
Any help would be deeply appreciated. My progress has completely stalled and I'm not sure what to do other than to try rebuilding the project piece by piece.
Many thanks...
By creating a Grails project that worked and slowly adding code I was able to find the problem. I had an improperly specified constraint.
class User {
String handle
String emailAddr
String salt
String password
boolean isAdmin
String toString()
{
String rslt = "$handle"
return rslt
}
static constraints = {
handle blank : false, nullable : false, unique : true
emailAddr blank : false, nullable : false, unique : true, email : true
salt blank: false, nullable: false
password blank: false, nullable: false
isAdmin false <<======= This is the problem!
}
static mapping = {
table 'users'
handle index : 'handle_Ix'
emailAddr index: 'email_ix'
isAdmin defaultValue: false
}
}
This should have been in the static mapping section:
static mapping = {
table 'users'
handle index : 'handle_Ix'
emailAddr index: 'email_ix'
isAdmin defaultValue: false <<== This is the right way to set the default
}
To put it mildly, its annoying that the error shows up as a thread creation error, without any other indication of other errors.
As #EElke points out in the comments, there's no indication at all that Postgres is the problem; the error that you should be looking at says Error creating bean with name 'sessionFactory' ... object is not an instance of declaring class.
My guess is that net.sf.hibernate.dialect.PostgreSQLDialect is the problem - replace that with org.hibernate.dialect.PostgreSQLDialect.
Also, delete this:
runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
since you already have
compile 'org.postgresql:postgresql:9.3-1101-jdbc41'
and runtime scope includes dependencies from compile scope.

Grails 2.3.4 - Error executing script Clean: _GrailsClasspath_groovy$_run_closure1

I am using eclipse kepler and after shutting down my computer and turning it on again I am getting this error message:
grails run-app --stacktrace
|Loading Grails 2.3.4
|Configuring classpath
.
|Environment set to development
.Error
|
Error executing script RunApp: _GrailsClasspath_groovy$_run_closure1 (NOTE: Stac
k trace has been filtered. Use --verbose to see entire trace.)
java.lang.NoClassDefFoundError: _GrailsClasspath_groovy$_run_closure1
at _GrailsClasspath_groovy.run(_GrailsClasspath_groovy:39)
at _GrailsClasspath_groovy$run.call(Unknown Source)
at _GrailsEvents_groovy$run.call(Unknown Source)
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
at _GrailsEvents_groovy.run(_GrailsEvents_groovy:32)
at _GrailsEvents_groovy$run.call(Unknown Source)
at _GrailsClean_groovy$run.call(Unknown Source)
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
at _GrailsClean_groovy.run(_GrailsClean_groovy:29)
at _GrailsClean_groovy$run.call(Unknown Source)
at _GrailsWar_groovy$run.call(Unknown Source)
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
at _GrailsWar_groovy.run(_GrailsWar_groovy:27)
at _GrailsWar_groovy$run.call(Unknown Source)
at _GrailsRun_groovy$run.call(Unknown Source)
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
at _GrailsRun_groovy.run(_GrailsRun_groovy:28)
at _GrailsRun_groovy$run.call(Unknown Source)
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
at RunApp.run(RunApp.groovy:25)
at RunApp$run.call(Unknown Source)
at gant.Gant.prepareTargets(Gant.groovy:607)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(Refl
ectiveInterceptor.java:1254)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(Refl
ectiveInterceptor.java:1254)
Caused by: java.lang.ClassNotFoundException: _GrailsClasspath_groovy$_run_closur
e1
... 29 more
Error |
Error executing script RunApp: _GrailsClasspath_groovy$_run_closure1
That is my BuildConfig which definitely worked before the restart:
grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.tet.reports.dir = "target/test-reports"
grails.project.work.dir = "target/work"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.fork = [
// configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
// compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the test-app JVM, uses the daemon by default
test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the run-app JVM
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the run-war JVM
war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the Console UI JVM
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
mavenRepo "http://repo.spring.io/milestone/"
mavenRepo "http://download.java.net/maven/2/"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
// runtime 'mysql:mysql-connector-java:5.1.24'
runtime 'org.postgresql:postgresql:9.3-1100-jdbc41'
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.47"
// plugins for the compile step
compile ":scaffolding:2.0.1"
compile ':cache:1.1.1'
// Spring Security and UI Plugin
compile ':spring-security-core:2.0-RC2'
compile ":spring-security-ui:1.0-RC1"
compile (":postgresql-extensions:0.6.1") {
excludes "hibernate"
}
//Grails Rich UI
compile ":richui:0.8"
// plugins needed at runtime but not for compilation
runtime ":hibernate:3.6.10.6" // or ":hibernate4:4.1.11.6"
runtime ":database-migration:1.3.8"
runtime ":jquery:1.10.2.2"
runtime ":resources:1.2.1"
// Uncomment these (or add new ones) to enable additional resources capabilities
//runtime ":zipped-resources:1.0.1"
//runtime ":cached-resources:1.1"
//runtime ":yui-minify-resources:0.1.5"
}
}
I tried a grails clean and grails compile and also cleaned the project under eclipse. However I am still getting the error message.
I really appreciate your answer on my problem
This is some error for the lib and plugin in grails to solved this,
Delete the folder
${Path_Project}\target\work
En run the commands
grails clean and grails compile
Clearing the working directory may not solve this problem always. In my case, I have fixed this issue by deleting the working directory as well as all the scripts in
%HOMEPATH%/.grails/2.3.4/projects/projectName/scriptCache
where "2.3.4" is Grails version and projectName denotes the Grails project name.

Add postgresql to grails 2.3.4

I have added the postgresql plugin from the grails page to my Buildconfig.groovy.
This is how the file looks like:
grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.tet.reports.dir = "target/test-reports"
grails.project.work.dir = "target/work"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.fork = [
// configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
// compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the test-app JVM, uses the daemon by default
test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the run-app JVM
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the run-war JVM
war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the Console UI JVM
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
// runtime 'mysql:mysql-connector-java:5.1.24'
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.47"
// plugins for the compile step
compile ":scaffolding:2.0.1"
compile ':cache:1.1.1'
compile ":postgresql-extensions:0.6.1"
// plugins needed at runtime but not for compilation
runtime ":hibernate:3.6.10.6" // or ":hibernate4:4.1.11.6"
runtime ":database-migration:1.3.8"
runtime ":jquery:1.10.2.2"
runtime ":resources:1.2.1"
// Uncomment these (or add new ones) to enable additional resources capabilities
//runtime ":zipped-resources:1.0.1"
//runtime ":cached-resources:1.1"
//runtime ":yui-minify-resources:0.1.5"
}
}
However when I run grails compile I get the output:
|Loading Grails 2.3.4
|Configuring classpath
|Downloading: org/grails/plugins/postgresql-extensions/0.6.1/postgresql-extensions-0.6.1.pom
|Downloading: org/grails/plugins/postgresql-extensions/0.6.1/postgresql-extensions-0.6.1.zip
.
|Environment set to development
......
|Installing zip postgresql-extensions-0.6.1.zip...
...
|Installed plugin postgresql-extensions-0.6.1
....................
|Compiling 152 source files
.Error
|
Compilation error: startup failed:
Compile error during compilation with javac.
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:9: error: package org.postgresql.util does not exist
import org.postgresql.util.PGobject;
^
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:14: error: cannot find symbol
public class HstoreParser extends PGobject implements Iterable<Map.Entry<String, String>> {
^
symbol: class PGobject
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:21: error: cannot find symbol
this.type = "hstore";
^
symbol: variable type
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:22: error: cannot find symbol
this.value = rawValue;
^
symbol: variable value
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:27: error: cannot find symbol
this.type = "hstore";
^
symbol: variable type
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:32: error: cannot find symbol
if (!"hstore".equals(this.type)) {
^
symbol: variable type
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:35: error: cannot find symbol
this.value = rawValue;
^
symbol: variable value
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:135: error: cannot find symbol
final char ch = value.charAt(++position);
^
symbol: variable value
location: class HstoreParser.HStoreIterator
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:220: error: cannot find symbol
char ch = value.charAt(++position);
^
symbol: variable value
location: class HstoreParser.HStoreIterator
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:225: error: cannot find symbol
final char nextCh = value.charAt(nextPosition);
^
symbol: variable value
location: class HstoreParser.HStoreIterator
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:229: error: cannot find symbol
sb = new StringBuilder(value.substring(firstQuotePosition + 1, nextPosition));
^
symbol: variable value
location: class HstoreParser.HStoreIterator
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:252: error: cannot find symbol
String r = value.substring(firstQuotePosition + 1, position);
^
symbol: variable value
location: class HstoreParser.HStoreIterator
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:262: error: cannot find symbol
final char ch = value.charAt(position);
^
symbol: variable value
location: class HstoreParser.HStoreIterator
C:\Users\user\GrailsWorkspace\grailsTestApplication\target\work\plugins\postgresql-extensions-0.6.1\src\java\net\kaleidos\hibernate\usertype\HstoreParser.java:273: error: cannot find symbol
final String r = value.substring(firstWordPosition, position + 1 );
^
symbol: variable value
location: class HstoreParser.HStoreIterator
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
14 errors
1 error
What is wrong with my installation process?
I really appreciate your answer!
Update
I have added this to my BuildConfig.groovy:
compile (":postgresql-extensions:0.6.1") {
excludes "hibernate"
}
However, I still get the same exceptions...
Update 2
This is how my BuildConfig.groovy looks now:
grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.tet.reports.dir = "target/test-reports"
grails.project.work.dir = "target/work"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.fork = [
// configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
// compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the test-app JVM, uses the daemon by default
test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the run-app JVM
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the run-war JVM
war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the Console UI JVM
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
// runtime 'mysql:mysql-connector-java:5.1.24'
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.47"
// plugins for the compile step
compile ":scaffolding:2.0.1"
compile ':cache:1.1.1'
compile (":postgresql-extensions:0.6.1") {
excludes "hibernate"
}
// plugins needed at runtime but not for compilation
runtime ":hibernate:3.6.10.6" // or ":hibernate4:4.1.11.6"
runtime ":database-migration:1.3.8"
runtime ":jquery:1.10.2.2"
runtime ":resources:1.2.1"
runtime 'org.postgresql:postgresql:9.3-1100-jdbc41'
// Uncomment these (or add new ones) to enable additional resources capabilities
//runtime ":zipped-resources:1.0.1"
//runtime ":cached-resources:1.1"
//runtime ":yui-minify-resources:0.1.5"
}
}
However, I get the error:
|Loading Grails 2.3.4
|Configuring classpath
Error |
Resolve error obtaining dependencies: Could not find artifact org.postgresql:postgresql:zip:9.3-1100-jdbc41 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Could not find artifact org.postgresql:postgresql:zip:9.3-1100-jdbc41 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Could not find artifact org.postgresql:postgresql:zip:9.3-1100-jdbc41 in grailsCentral (http://repo.grails.org/grails/plugins)
|Run 'grails dependency-report' for further information.
You need to add the postgresql-jdbc driver to your BuildConfig. Your dependencies section should look like this:
dependencies {
runtime 'org.postgresql:postgresql:9.3-1100-jdbc41'
}
Then it should compile.