title: Upgrading grails from 2.1.1 to 2.4.3
body: <p>I am upgrading a grails app from 2.1.1 to 2.4.3 and solving errors along the upgrade is a never ending story.</p>
  
  <p>Now I am stuck at this point.</p>
  
  <p>Any ideas how to solve this?</p>
  
  <p>Thanks!</p>
  
  <p>C:\workspace\grails_apps\monitoring>grails run-app</p>
  
  <pre><code>| Running Grails application
  | Error 2014-09-20 17:36:55,136 [localhost-startStop-1] ERROR context.ContextLoader  - Context initialization failed
  Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'grailsResourceLoader' while setting bean property 'grailsResourceLoader'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean] for bean with name 'grailsResourceLoader' defined in ServletContext resource [/WEB-INF/appli
  cationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
      Line | Method
  -&gt;&gt;  334 | innerRun  in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    166 | run       in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run . . . in java.lang.Thread
  
  Caused by CannotLoadBeanClassException: Cannot find class [org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean] for bean with name 'grailsResourceLoader' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
  -&gt;&gt;  334 | innerRun  in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    166 | run       in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run . . . in java.lang.Thread
  
  Caused by ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
  -&gt;&gt;   59 | findClass in org.grails.plugins.tomcat.ParentDelegatingClassLoader
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    423 | loadClass in java.lang.ClassLoader
  |    356 | loadClass in     ''
  |    334 | innerRun  in java.util.concurrent.FutureTask$Sync
  |    166 | run . . . in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run       in java.lang.Thread
  | Error 2014-09-20 17:36:55,270 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'grailsResourceLoader' while setting bean property 'grailsResourceLoader'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.codehaus.groovy.grails.commo
  ns.GrailsResourceLoaderFactoryBean] for bean with name 'grailsResourceLoader' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
  Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'grailsResourceLoader' while setting bean property 'grailsResourceLoader'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean] for bean with name 'grailsResourceLoader' defined in ServletContext resource [/WEB-INF/appli
  cationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
      Line | Method
  -&gt;&gt;  334 | innerRun  in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    166 | run       in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run . . . in java.lang.Thread
  
  Caused by CannotLoadBeanClassException: Cannot find class [org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean] for bean with name 'grailsResourceLoader' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
  -&gt;&gt;  334 | innerRun  in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    166 | run       in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run . . . in java.lang.Thread
  
  Caused by ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
  -&gt;&gt;   59 | findClass in org.grails.plugins.tomcat.ParentDelegatingClassLoader
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    423 | loadClass in java.lang.ClassLoader
  |    356 | loadClass in     ''
  |    334 | innerRun  in java.util.concurrent.FutureTask$Sync
  |    166 | run . . . in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run       in java.lang.Thread
  </code></pre>
  
  <p><strong>BuildConfig.groovy</strong></p>
  
  <pre><code>grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0)
  grails.server.port.http = 8090
  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.dependency.resolver = "maven" 
  //grails.project.war.file = "target/${appName}-${appVersion}.war"
  
  // uncomment (and adjust settings) to fork the JVM to isolate classpaths
  //grails.project.fork = [
  //   run: [maxMemory:1024, minMemory:64, debug:false, maxPerm:256]
  //]
  
  grails.project.dependency.resolution = {
      // inherit Grails' default dependencies
      inherits("global") {
          // specify dependency exclusions here; for example, uncomment this to disable ehcache:
          // excludes 'ehcache'
      }
      log "warn" // 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()
          grailsCentral()
  
          mavenLocal()
          mavenCentral()
  
          // uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
          //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 e.g.
  
          // runtime 'mysql:mysql-connector-java:5.1.20'
  
  
      }
  
      plugins {
          runtime ":hibernate4:4.3.5.5"
          runtime ":jquery:1.11.1"
  
          build ":tomcat:7.0.54"
  
          runtime ":database-migration:1.4.0"
  
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p>Instead of upgrading an existing grails application I tried to create a new application and copy files to the new project. This approach results in a different error.</p>
  
  <p><strong>grails run-app</strong></p>
  
  <pre><code>| Running Grails application
  Error occurred during initialization of VM
  agent library failed to init: instrument
  Error opening zip file or JAR manifest missing : C:\Program%20Files%20(x86)\Grails\grails-2.4.3\lib\org.springframework\springloaded\jars\springloaded-1.2.0.RELEASE.jar
  | Error Forked Grails VM exited with error
  </code></pre>
  
  <p><em>java version used: 1.7.0_21</em></p>
  
  <p><em>GRAILS_HOME=C:\PROGRA~2\grails\grails-2.4.3</em></p>
  
  <p><em>GROOVY_HOME=C:\PROGRA~2\Groovy\groovy-2.3.6</em></p>
  
  <p><em>Grails version: 2.4.3</em></p>
  
  <p><strong>What to do now?</strong></p>
  
  <p>Thanks!</p>
  
  <h2>----------------------------------------------------</h2>
  
  <p>Based on the suggestion below to remove reference to bean 'grailsResourceLoader, I changed the applicationContext.xml accordingly.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"&gt;
  
      &lt;bean id="grailsApplication" class="org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean"&gt;
          &lt;description&gt;Grails application factory bean&lt;/description&gt;
          &lt;property name="grailsDescriptor" value="/WEB-INF/grails.xml" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="pluginManager" class="org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean"&gt;
          &lt;description&gt;A bean that manages Grails plugins&lt;/description&gt;
          &lt;property name="grailsDescriptor" value="/WEB-INF/grails.xml" /&gt;
          &lt;property name="application" ref="grailsApplication" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="grailsConfigurator" class="org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator"&gt;
          &lt;constructor-arg&gt;
              &lt;ref bean="grailsApplication" /&gt;
          &lt;/constructor-arg&gt;
          &lt;property name="pluginManager" ref="pluginManager" /&gt;
      &lt;/bean&gt;
  
  
      &lt;bean id="characterEncodingFilter" class="org.springframework.web.filter.CharacterEncodingFilter"&gt;
          &lt;property name="encoding"&gt;
              &lt;value&gt;utf-8&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>Unfortunately, the problem remains the same.</p>
  
  <pre><code>| Running Grails application
  Error opening zip file or JAR manifest missing : C:\Program%20Files%20(x86)\Grails\grails-2.4.3\lib\org.springframework\springloaded\jars\springloaded-1.2.0.RELEASE.jar
  Error occurred during initialization of VM
  agent library failed to init: instrument
  | Error Forked Grails VM exited with error
  </code></pre>
  
  <p>Thanks for any further help!!</p>
  
  <h2>-----------------------------------------</h2>
  
  <p><strong>Is Java 1.8.0 required for Grails 2.4.3 ?</strong></p>
  
  <ul>
  <li>No it is not, problem is the same even for java 8</li>
  </ul>