Add postgresql to grails 2.3.4 - postgresql

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.

Related

liquibase diff does not works

I am attempting to make Spring Boot 2.2.x application (Java 13) with Code-First approach using Hibernate and Liquibase. I would like to generate migrations base on difference between Entities object and database.
OS - Win 10 and Mint 18
Build system - gradle 6.0.
Database - Postgres SQL.
I installed liquibase utilities (3.8.2).
My gradle script:
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'net.ltgt.gradle:gradle-apt-plugin:0.18'
classpath 'org.postgresql:postgresql:42.2.9'
classpath 'org.liquibase:liquibase-core:3.8.2'
classpath "org.liquibase:liquibase-gradle-plugin:2.0.2"
}
}
plugins {
id 'org.springframework.boot' version '2.2.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'org.liquibase.gradle' version '2.0.2'
id 'java'
}
group = 'com.goodt.drive'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '13'
targetCompatibility = '13'
diff.dependsOn compileJava
diffChangeLog.dependsOn compileJava
generateChangelog.dependsOn compileJava
dependencies {
liquibaseRuntime 'org.liquibase:liquibase-core:3.8.2'
liquibaseRuntime "jakarta.xml.bind:jakarta.xml.bind-api:2.3.2"
liquibaseRuntime 'org.springframework.boot:spring-boot:2.2.1.RELEASE'
liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:2.0.1'
liquibaseRuntime 'org.postgresql:postgresql:42.2.9'
liquibaseRuntime 'org.hibernate:hibernate-core:5.4.10.Final'
liquibaseRuntime 'ch.qos.logback:logback-core:1.2.3'
liquibaseRuntime 'ch.qos.logback:logback-classic:1.2.3'
liquibaseRuntime sourceSets.main.output
}
def dbChangeLog = "$projectDir/src/main/resources/db/changelog/changelog.xml"
def generatedChangeLog = "$projectDir/src/main/resources/db/changelog/generated_changelog.xml"
liquibase {
activities {
main {
changeLogFile dbChangeLog
outputFile generatedChangeLog
driver "org.postgresql.Driver"
classpath "$projectDir/lib/postgresql-42.2.9.jar"
url "jdbc:postgresql://localhost:5432/webportal"
username "developer"
password "123"
referenceUrl "hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect"
//referenceDriver 'liquibase.ext.hibernate.database.connection.HibernateDriver'
}
}
}
When i am runnung liquibase diff command from gradle script like this: .\gradlew.bat diff i am getting following output:
> Task :diff
liquibase-plugin: Running the 'main' activity...
12:48:14.372 INFO [liquibase.integration.commandline.Main]: Starting Liquibase at ёЁ, 15  эт. 2020 12:48:14 YEKT (version 3.8.2 #26 built at Tue Nov 26 04:53:39 UTC 2019)
12:48:15.323 INFO [liquibase.integration.commandline.Main]: No Liquibase Pro license key supplied. Please set liquibaseProLicenseKey on command line or in liquibase.properties to use Liquibase Pro features.
12:48:15.325 INFO [liquibase.integration.commandline.Main]: Liquibase Community 3.8.2 by Datical
12:48:15.614 ERROR [liquibase.integration.commandline.Main]: Unexpected error running Liquibase: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect)
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:132)
at liquibase.integration.commandline.Main.createReferenceDatabaseFromCommandParams(Main.java:1604)
at liquibase.integration.commandline.Main.doMigration(Main.java:1200)
at liquibase.integration.commandline.Main.run(Main.java:229)
at liquibase.integration.commandline.Main.main(Main.java:143)
Caused by: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:263)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:149)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:97)
... 4 common frames omitted
Caused by: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:200)
... 6 common frames omitted
The stack trace indicates that Liquibase Cannot find database driver and Driver class was not specified and could not be determined from the url (hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect)
This indicates that you should add the liquibase-hibernate jar to your dependencies and uncomment the referenceDriver line in your gradle script.
I updated liquibase (in gradle) to version 3.8.4
I added liquibaseRuntime lines with liquibase-hibernate and spring-data-jpa
I added to liquibase-hibernate and spring-data-jpa classpath {} section of gradle script.
One more addition, i write an article about how to use liquibase you could find it here: https://m-ushakov.medium.com/code-first-with-spring-boot-hibernate-and-liquibase-48f5c9998d95
Whole Gradle script:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'net.ltgt.gradle:gradle-apt-plugin:0.18'
classpath 'org.postgresql:postgresql:42.2.9'
classpath 'org.liquibase.ext:liquibase-hibernate5:3.8'
classpath 'org.liquibase:liquibase-core:3.8.4'
classpath 'org.liquibase:liquibase-gradle-plugin:2.0.2'
classpath 'org.springframework.data:spring-data-jpa:2.2.1.RELEASE'
}
}
plugins {
id 'org.springframework.boot' version '2.2.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'org.liquibase.gradle' version '2.0.2'
id 'java'
}
group = 'com.wissance.webportal'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '13'
targetCompatibility = '13'
ext {
set('springCloudVersion', "Hoxton.RC2")
set('queryDslVersion', "4.1.3")
set('swaggerVersion', "2.9.2")
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
}
diff.dependsOn compileJava
diffChangeLog.dependsOn compileJava
generateChangelog.dependsOn compileJava
dependencies {
// spring boot
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile 'org.springframework.boot:spring-boot-starter-hateoas'
compile 'org.springframework.boot:spring-boot-starter-web'
// spring cloud
//implementation 'org.springframework.cloud:spring-cloud-starter-config'
//implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
// JAX-B dependencies for JDK 9+
implementation "jakarta.xml.bind:jakarta.xml.bind-api:2.3.2"
implementation "org.glassfish.jaxb:jaxb-runtime:2.3.2"
// other
compile 'org.postgresql:postgresql:42.2.1'
compile 'com.h2database:h2'
compile 'org.hibernate:hibernate-core:5.4.10.Final'
compileOnly 'org.projectlombok:lombok'
//runtimeOnly 'org.postgresql:postgresql'
runtime 'javax.xml.bind:jaxb-api'
//runtime 'org.liquibase:liquibase-core'
liquibaseRuntime 'org.liquibase:liquibase-core:3.8.4'
liquibaseRuntime "jakarta.xml.bind:jakarta.xml.bind-api:2.3.2"
liquibaseRuntime 'org.springframework.boot:spring-boot:2.2.1.RELEASE'
liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:2.0.1'
liquibaseRuntime 'org.postgresql:postgresql:42.2.9'
liquibaseRuntime 'org.springframework.data:spring-data-jpa:2.2.1.RELEASE'
liquibaseRuntime 'org.hibernate:hibernate-core:5.4.10.Final'
liquibaseRuntime 'org.liquibase.ext:liquibase-hibernate5:3.8'
liquibaseRuntime 'ch.qos.logback:logback-core:1.2.3'
liquibaseRuntime 'ch.qos.logback:logback-classic:1.2.3'
liquibaseRuntime sourceSets.main.output
// TESTS
//testImplementation('org.springframework.boot:spring-boot-starter-test') {
// exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
//}
testCompile('org.junit.jupiter:junit-jupiter-engine:5.2.0')
// QueryDsl
compile "com.querydsl:querydsl-core:${queryDslVersion}"
compile "com.querydsl:querydsl-jpa:${queryDslVersion}"
// Swagger
compile "io.springfox:springfox-swagger2:${swaggerVersion}"
compile "io.springfox:springfox-swagger-ui:${swaggerVersion}"
annotationProcessor (
"org.projectlombok:lombok",
"com.querydsl:querydsl-apt:${queryDslVersion}:jpa",
"org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final",
"javax.annotation:javax.annotation-api:1.3.2"
)
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
def dbChangeLog = "$projectDir/src/main/resources/db/changelog/changelog.xml"
def generatedChangeLog = "$projectDir/src/main/resources/db/changelog/generated_changelog.xml"
/*task copyToLib(type: Copy) {
into "$buildDir/output/libs"
from configurations.runtime
}*/
liquibase {
activities {
main {
changeLogFile dbChangeLog
outputFile generatedChangeLog
driver "org.postgresql.Driver"
// classpath "$projectDir/lib/postgresql-42.2.9.jar"
url "jdbc:postgresql://localhost:5432/webportal
password "123"
referenceUrl "hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect"
referenceDriver 'liquibase.ext.hibernate.database.connection.HibernateDriver'
}
}
}
jar {
enabled = true
manifest {
attributes 'Main-Class': 'com.wissance.webportal.Application'
}
}
test {
useJUnitPlatform()
}
Not sure if it's related to the errors you are experiencing or not, but Liquibase recently posted a 3.8.4 version that corrects some Spring Boot errors with Java 9+. https://www.liquibase.org/2019/12/liquibase-3-8-4-released.html
I'd try running that to see if it resolves the issue for you.

Gradle issues with android support compilation in Unity export

I have a multidex issue while compiling my project in Unity so I exported the project and imported it to gradle. I've fixed most dependencies but I cannot get rid of the following problem:
FAILURE: Build failed with an exception.
12:05:17.012 [ERROR] [org.gradle.BuildExceptionReporter]
12:05:17.012 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
12:05:17.012 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':mainProj:transformClassesWithJarMergingForRelease'.
12:05:17.012 [ERROR] [org.gradle.BuildExceptionReporter] > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/compat/BuildConfig.class
12:05:17.012 [ERROR] [org.gradle.BuildExceptionReporter]
and that goes to all support* projects. I had similar issues with other sdks but I fixed them by deleting the BuildConfig.class from their classes.jar files. For some reason, when I delete this class for the supportcompat2500 project (in this specific example) it keeps coming back - and I don't know where from.
my settings.gradle is:
include ':amazonAppStore'
include ':appLovin'
include ':chartboost'
include ':googleAIDL'
include ':googlePlay'
include ':heyzap'
include ':oneSignalConfig'
include ':samsungApps'
include ':shortcutBadger115'
include ':unityAds'
include ':vungle'
include ':animatedvectordrawable2500'
include ':cardviewv72340'
include ':common'
include ':customtabs2340'
include ':facebookandroidsdk4170'
include ':facebookandroidwrapper790'
include ':onesignalunity'
include ':playservicesads980'
include ':playservicesadslite980'
include ':playservicesbase980'
include ':playservicesclearcut980'
include ':playservicesgass980'
include ':playservicesgcm980'
include ':playservicesiid980'
include ':playserviceslocation980'
include ':playservicestasks980'
include ':supportcompat2500'
include ':supportcoreui2500'
include ':supportcoreutils2500'
include ':supportfragment2500'
include ':supportmediacompat2500'
include ':supportv42500'
include ':supportvectordrawable2500'
include ':mainProj'
mainProj.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.mainProj.mainProj"
minSdkVersion 15
targetSdkVersion 24
// Enabling multidex support.
multiDexEnabled true
}
lintOptions {
quiet true
abortOnError false
ignoreWarnings true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java.com.mainProj.mainProj']
resources.srcDirs = ['src/main/res']
renderscript.srcDirs = ['src']
res.srcDirs = ['src/main/res']
assets.srcDirs = ['src/main/assets.bin.Data']
jniLibs.srcDirs = ['src/main/jniLibs']
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
dependencies {
compile 'com.android.support:multidex:1+'
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':amazonAppStore')
compile project(':appLovin')
compile project(':chartboost')
compile project(':googleAIDL')
compile project(':googlePlay')
compile project(':cardviewv72340')
compile project(':customtabs2340')
compile project(':heyzap')
compile project(':oneSignalConfig')
compile project(':samsungApps')
compile project(':shortcutBadger115')
compile project(':unityAds')
compile project(':vungle')
compile project(':common')
compile project(':facebookandroidsdk4170')
compile project(':facebookandroidwrapper790')
compile project(':onesignalunity')
compile project(':playservicesads980')
compile project(':playservicesadslite980')
compile project(':playservicesbase980')
compile project(':playservicesclearcut980')
compile project(':playservicesgass980')
compile project(':playservicesgcm980')
compile project(':playservicesiid980')
compile project(':playserviceslocation980')
compile project(':playservicestasks980')
compile project(':supportcompat2500')
compile project(':supportcoreui2500')
compile project(':supportcoreutils2500')
compile project(':supportfragment2500')
compile project(':supportmediacompat2500')
compile project(':supportv42500')
compile project(':supportvectordrawable2500')
}
Project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
Would appreciate any advice/referenece. Thanks.
The problem was that
facebookandroidwrapper790
already include com.android.support and all of its sub-projects.
I've removed all
compile project(':support*')

How to configure mongodb with grails

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/

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.