title: Class not found loading Grails application - after grails upgrade to 2.3
body: <p>I am upgrading <strong>grails version from 2.1.1 to 2.3.0</strong> with the help of <a href="http://grails.org/doc/2.3.x/guide/upgradingFromPreviousVersionsOfGrails.html" rel="nofollow">official grails doc</a>. </p>
  
  <p>Honestly, I followed the steps one by one. I also had upgraded one of my grails project to 2.3.0 months before successfully. Unfortunately this time am failing. Following error is hitting me hard.</p>
  
  <pre><code>| Error 2013-11-09 17:26:26,933 [localhost-startStop-1] ERROR context.ContextLoader  - Context initialization failed
  Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: eccount.MainController
      Line | Method
  -&gt;&gt;  334 | innerRun  in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |    166 | run       in java.util.concurrent.FutureTask
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run . . . in java.lang.Thread
  
  Caused by GrailsConfigurationException: Class not found loading Grails application: eccount.MainController
  -&gt;&gt;  334 | innerRun  in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |    166 | run       in java.util.concurrent.FutureTask
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run . . . in java.lang.Thread
  
  Caused by ClassNotFoundException: eccount.MainController
  -&gt;&gt;  366 | run       in java.net.URLClassLoader$1
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |    355 | run       in     ''
  |    354 | findClass in java.net.URLClassLoader
  |    423 | loadClass in java.lang.ClassLoader
  |    334 | innerRun  in java.util.concurrent.FutureTask$Sync
  |    166 | run       in java.util.concurrent.FutureTask
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run . . . in java.lang.Thread
  | Error 2013-11-09 17:26:27,032 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: eccount.MainController
  Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: eccount.MainController
      Line | Method
  -&gt;&gt;  334 | innerRun  in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |    166 | run       in java.util.concurrent.FutureTask
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run . . . in java.lang.Thread
  
  Caused by GrailsConfigurationException: Class not found loading Grails application: eccount.MainController
  -&gt;&gt;  334 | innerRun  in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |    166 | run       in java.util.concurrent.FutureTask
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run . . . in java.lang.Thread
  
  Caused by ClassNotFoundException: eccount.MainController
  -&gt;&gt;  366 | run       in java.net.URLClassLoader$1
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |    355 | run       in     ''
  |    354 | findClass in java.net.URLClassLoader
  |    423 | loadClass in java.lang.ClassLoader
  |    334 | innerRun  in java.util.concurrent.FutureTask$Sync
  |    166 | run       in java.util.concurrent.FutureTask
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run . . . in java.lang.Thread
  </code></pre>
  
  <p><strong>plugins section of <code>BuildConfig.groovy</code></strong></p>
  
  <pre><code>  plugins {
  
          runtime ":hibernate:$slurp.app.hibernate.version"
          build   ":tomcat:$slurp.app.tomcat.version"
          compile ':scaffolding:1.0.0'
      }
  </code></pre>
  
  <p><strong>My <code>applicationContext.xml</code> is as below which I don't think is incorrect.</strong></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.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;property name="grailsResourceLoader" ref="grailsResourceLoader" /&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="grailsResourceLoader" class="org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean" /&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;bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean" /&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>I went through following <strong>Hit and Trials(H&amp;T)</strong> but couldn't succeed.</p>
  
  <p><strong>H&amp;T 1)</strong> </p>
  
  <pre><code>$ grails clean
  $ grails run-app
  </code></pre>
  
  <p><strong>H&amp;T 2)</strong> </p>
  
  <pre><code>$ rm -r ~/.grails/2.3.0/projects/gccount
  $ grails clean
  $ grails run-app
  </code></pre>
  
  <p><strong>H&amp;T 3)</strong></p>
  
  <p>3.1) replaced <code>grails.project.dependency.resolver="maven"</code> to  <code>grails.project.dependency.resolver="ivy"</code>. Also tried coming back to maven again.</p>
  
  <p>3.2)</p>
  
  <pre><code>$ grails clean
  $ grails run-app
  </code></pre>
  
  <p><strong>H&amp;T 4)</strong> </p>
  
  <pre><code>$ rm -r target/
  $ grails clean
  $ grails run-app
  </code></pre>