grails upgrade from 2.2.0 to 2.3.4 - grails

Hi I upgraded my Grails application from 2.2.0 to Grails 2.3.4, but I'm getting this error :
|Loading Grails 2.3.4
|Configuring classpath
Error |
Resolve error obtaining dependencies: Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- org.apache.tomcat.embed:tomcat-embed-core:7.0.47
- org.apache.tomcat:tomcat-catalina-ant:7.0.47
- org.apache.tomcat.embed:tomcat-embed-jasper:7.0.47
(Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- org.grails:grails-datastore-gorm-hibernate:2.0.6.RELEASE
- junit:junit-dep:4.10
(Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- org.grails:grails-datastore-gorm-hibernate:2.0.6.RELEASE
(Use --stacktrace to see the full trace)
Error |
Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- org.apache.tomcat.embed:tomcat-embed-core:7.0.47
- org.apache.tomcat:tomcat-catalina-ant:7.0.47
- org.apache.tomcat.embed:tomcat-embed-jasper:7.0.47
Any recommendations to fix this issue ?

From the Grails 2.3.4 Release Notes
If you are upgrading from previous versions of Grails 2.3.x and you use the Hibernate and/or Tomcat plugins you will need to update the versions in BuildConfig:
build ':tomcat:7.0.47'
runtime ':hibernate:3.6.10.6'
And since you are upgrading from 2.3, I think you should also read What's new in Grails 2.3?

Grails 2.3.4 requires you to upgrade most of your dependencies. I don't know all but I think you have to upgrade hibernate to hibernate 3. Here's what my current project's BuildConfig looks like:
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
runtime 'mysql:mysql-connector-java:5.1.24'
//compile 'com.paypal.sdk:merchantsdk:2.4.103'
compile 'joda-time:joda-time:2.2'
compile ('org.apache.poi:poi:3.9','org.apache.poi:poi-ooxml:3.9')
compile 'com.stripe:stripe-java:1.3.0'
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.41"
// plugins for the compile step
compile ":scaffolding:2.0.0.RC1"
compile ':cache:1.1.1'
// plugins needed at runtime but not for compilation
runtime ":hibernate:3.6.10.6" // or ":hibernate4:4.1.11.M2"
runtime ":database-migration:1.3.5"
compile ":jquery:1.10.2"
runtime ":resources:1.2"
// 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"
//app plugins
compile ':webflow:2.0.8.1'
compile ":mail:1.0.1"
compile ":asynchronous-mail:1.0-RC5" //1.0
compile ":spring-security-core:1.2.7.3"
compile ':excel-export:0.1.10'
compile ":spring-security-core:1.2.7.3"
test ":spock:0.7"
}
This works for me.

Related

Grails 2.4.4 UNRESOLVED DEPENDENCIES cglib 2.2.2

I am trying to upgrade a project to grails version 2.4.4 but it keep failing with the following error message:
:: problems summary ::
:::: WARNINGS
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: cglib#cglib;2.2.2: configuration not found in cglib#cglib;2.2.2: 'compile'. It was required from org.grails#grails-plugin-testing;2.4.4 runtime
::::::::::::::::::::::::::::::::::::::::::::::
Error |
Resolve error obtaining dependencies: Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- cglib:cglib:2.2.2
(Use --stacktrace to see the full trace)
Error |
Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- cglib:cglib:2.2.2
|Run 'grails dependency-report' for further information.
This s kind of weird since the library is available. I can see it under grails-2.4.4\lib\cglib\cglib\jars and in my home directory under .grails\ivy-cache\cglib\cglib\jars
My GRAILS_HOME is set correctly and for what I can see all looks fine but when I do a refresh dependencies it keeps throwing this error.
In upgrading from Grails 2.1 to 2.4.4 I found I had that same issue. The resolution was to explicitly set:
grails.project.dependency.resolver = "maven"
in BuildConfig.groovy. Then I was able to move on to the next issue in the upgrade ... ;-)

envers and hibernate plugins incompatibility

I'm using hibernate plugin and trying to integrate envers plugins to my project. But the following issue appears:
when I'm trying to start project it gives me an exception:
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[groovyc] General error during conversion: java.lang.NoClassDefFoundError: org/hibernate/event/PostInsertEventListener
my build config is as follows:
{
plugins {
// plugins for the build system only
build ":tomcat:7.0.54"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.7'
compile ":asset-pipeline:1.8.11"
compile ":spring-security-ui:1.0-RC2"
// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.5.4" // or ":hibernate:3.6.10.16"
runtime ":envers:2.1.0"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
}
I tried to find PostInsertEventListener class and I found it but under different package - under org.hibernate.event.spi and for some reason it tries to find it in under org/hibernate/event. Is it some plugins incompatibility issue? Thank you!
run grails dependency-report to see the conflicts
you can also try replacing the hib4 plugin with hib3. this should most probably be causing the compile error

Update to 2.3.9 - Error executing script RunApp: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling

I am update grails from 2.3.7 to 2.3.9 and it has error
Error executing script RunApp:
org/codehaus/groovy/runtime/typehandling/ShortTypeHandling.
Here is run-app --stacktrace --verbose :
|Loading Grails 2.3.9
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
...........
|Compiling 1 source files
[groovyc] Compiling 1 source file to
Z:\future13_grails\cerp\target\classes
.....................................Error
|
Error executing script RunApp:
org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
java.lang.NoClassDefFoundError:
org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
at
org.grails.plugins.tomcat.TomcatServer.(TomcatServer.groovy:81)
at
org.grails.plugins.tomcat.InlineExplodedTomcatServer.(InlineExplodedTomcatServer.groovy)
at
org.grails.plugins.tomcat.TomcatServerFactory.createInline(TomcatServerFactory.groovy:38)
at
org.codehaus.groovy.grails.project.container.GrailsProjectRunner.runInline(GrailsProjectRunner.groovy:183)
at
org.codehaus.groovy.grails.project.container.GrailsProjectRunner.runApp(GrailsProjectRunner.groovy:119)
at
org.codehaus.groovy.grails.project.container.GrailsProjectRunner$runApp$0.call(Unknown
Source)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
...
Error | Error executing script RunApp:
org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
And here is BuildConfig.groovy
... plugins {
// plugins for the build system only
build ':tomcat:7.0.52.1'
// plugins for the compile step
compile ':scaffolding:2.0.3'
compile ':cache:1.1.1'
compile ":spring-security-core:2.0-RC2"
compile ":searchable:0.6.6"
// plugins needed at runtime but not for compilation
runtime ':hibernate:3.6.10.15' // ':hibernate4:4.3.5.3' for Hibernate 4
runtime ':database-migration:1.4.0'
runtime ":jquery:1.10.2"
runtime ':resources:1.2.8'
// 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"
runtime ":cors:1.1.2"
} ...
I deleted target folder and run grails, it run successfully.
If deleting the target folder doesn't work for your, use the clean and compile commands before trying to run your project again.
Duplicate question Groovy ShortTypeHandling ClassNotFoundException.
I doubt any of the plugin's version is only compatible with Grails version 2.4.0 and above (which comes with Groovy 2.3.*).

Creating Ldap Plug ii Grails 2.3

I'm trying to move my project from Grails 2.2.4 to Grails 2.3.5, and I need some plugins, one of them is Ldap's. To access to my repository I have an URL:
grailsRepo "http:// svn................"
and my dependency resolver is maven
an Y have this code after:
plugins {
// plugins for the build system only
build ":tomcat:7.0.50"
// plugins for the compile step
compile ":scaffolding:2.0.1"
compile ':cache:1.1.1'
// plugins needed at runtime but not for compilation
runtime ":hibernate:3.6.10.7"// or ":hibernate4:4.1.11.6" or hibernate:3.6.10.7
runtime ":database-migration:1.3.8"
runtime ":jquery:1.10.2.2"
runtime ":resources:1.2.1"
compile ":ldap:0.8.3.2"
}
and I got the next error
The following artifacts could not be resolved: org.grails.plugins:ldap:zip:0.8.3.2, org.grails.plugins:spring-security-ldap-dcas:zip:1.0.6: Could not find artifact org.grails.plugins:ldap:zip:0.8.3.2 in grailsCentral (http://repo.grails.org/grails/plugins)
|Run 'grails dependency-report' for further information.
It looks like the latest version of the ldap plugin is 0.8.2 - see http://grails.org/plugin/ldap
If this is a custom build that's in your local repo, try switching to the ivy resolver

Getting Error Fatal error during compilation org.apache.tools.ant.BuildException: Compilation Failed. in grails app

When I run grails run-app through terminal or using Grails/Groovy tool suite, it gets "compilation error" with
`Error Fatal error during compilation org.apache.tools.ant.BuildException: Compilation Failed (Use --stacktrace to see the full tr`ac`e)
.
I am using grails 2.0. Below is what happen when I run grails run-app through ubuntu terminal.
Loading Grails 2.0.0
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application
> You currently already have a version of the plugin installed [hibernate-2.0.0]. Do you want to update to [hibernate-3.6.10.2]? [y,n] n
| Plugin hibernate-3.6.10.2 install aborted
> You currently already have a version of the plugin installed [tomcat-2.0.0]. Do you want to update to [tomcat-7.0.42]? [y,n] n
| Plugin tomcat-7.0.42 install aborted
> You currently already have a version of the plugin installed [release-2.2.1]. Do you want to update to [release-3.0.1]? [y,n] n
| Plugin release-3.0.1 install aborted
| Plugin release-3.0.1 install aborted..
Compiling 4 source files.
| Error Fatal error during compilation org.apache.tools.ant.BuildException: Compilation Failed (Use --stacktrace to see the full trace
)
BuildConfig.groovy
grails.servlet.version = "2.5" // 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.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment 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
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
grailsCentral()
mavenCentral()
// uncomment these to enable remote dependency resolution from public Maven repositories
//mavenCentral()
//mavenLocal()
//mavenRepo "http://snapshots.repository.codehaus.org"
//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 eg.
runtime 'mysql:mysql-connector-java:5.1.16'
}
plugins {
build ':release:2.2.1', ':rest-client-builder:1.0.3', {
export = false
}
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.7.1"
runtime ":spring-security-core:1.2.7.2"
runtime ':resources:1.2'
runtime ":cached-resources:1.0"
runtime ":zipped-resources:1.0"
compile ":cache-headers:1.1.5"
build ":tomcat:2.0.0"
//compile ":attachmentable:0.3.0"
compile ":searchable:0.6.4"
compile ":cloud-bees:0.6.2"
compile ":jquery-validation:latest.release"
compile ":jquery-validation-ui:latest.release"
compile ":twitter-bootstrap:2.3.2"
compile ":lesscss-resources:1.3.3"
runtime ":fields:1.3"
compile ":mail:1.0.1"
compile ":jquery-ui:1.8.24"
compile ":spring-security-ui:0.2"
compile ":mail:1.0"
compile ":famfamfam:1.0"
compile ":spring-security-acl:1.1.1"
}
}
When I run grails run-app, It always ask for updating tomcat and hibernate plugings to latest version. I dont know why this is happening. Any suggestion on this.
Can It related to tomcat and hibernate plugin versons?
application.properties
#Grails Metadata file
#Thu Nov 14 15:09:35 IST 2013
app.grails.version=2.0.0
app.name=VProcureFinal
app.servlet.version=2.5
app.version=0.1
plugins.avatar=0.6.3
plugins.burning-image=0.5.1
plugins.class-diagram=0.5.2
plugins.jquery-validation-ui=1.4.4
plugins.prototype=1.0
plugins.richui=0.8
plugins.webxml=1.4.1
*grails run-app out*put:
grails run-app
| Packaging Grails application
> You currently already have a version of the plugin installed [tomcat-2.0.0]. Do you want to update to [tomcat-7.0.42]? [y,n] n
| Installed plugin release-3.0.1
| Error Plugin release-3.0.1 requires version [2.3 > *] of Grails which your current Grails installation does not meet. Please try install a different version of the plugin or Grails.
| Installed plugin release-3.0.1
.
A couple of suggestions. The most likely answer is applications.properties specifying something different to BuildConfig.groovy.
You are running 2.0.0. How about at least trying 2.0.4 as there would be bug fixes?
BuildConfig.groovy doesn't look like the authoritative source. e.g. tomcat is specified as 2.0.0 specifically so you don't have the typical upgrade problem, where in 2.3.x these plugins moved from $grailsVersion.
Check application.properties. The grails version in there will be 2.0.0 - can see this from the startup. The tomcat and hibernate versions may be specified here as the versions you see in the startup.
grails clean and/or delete .grails directory in your home directory.

Resources