Grails 2.3.1 on Mac; Class NotFound NoUniqueBeanDefinitionException

I recently updated my Grails project to version 2.3.1 from 2.0.1. The project works fine on my Window machine and on my colleague Mac (pulled through Git). However, on my Mac, I get this error when I try to launch the application after the plugins are installed and compiled:

ClassNotFoundException: org.springframework.beans.factory.NoUniqueBeanDefinitionException 

The full stack trace is at http://pastebin.com/iEvKBmG5 , but that is the point of the error.

If I run grails interactively, the server starts, but when I go to the controller, I just get a white page.

What can be different from my environment on my Mac and the environment of my colleague that causes this error? Here I tried to fix the problem:

  • Removing the contents of my ~ / .grails folder (as well as less extreme options for cleaning individual subfolders)
  • Removing a project and extracting it from git
  • grails clean
  • Reinstall Grails 2.3.1 (using gvm, so my commands were gvm uninstall grails 2.3.1 , gvm flush archives , gvm install grails 2.3.1 )
  • Cloning project contents to another directory
  • Checking the dependency report to ensure that the spring version is more than 3.2.1, to which the NoUniqueBeanDefinitionException class has been added. For a full report, see http://pastebin.com/0AVC0SA0 .
  • Verify that the NoUniqueBeanDefinitionException.class file is in the spring-beans jar located at ~ / .gvm / grails / 2.3.1 / lib / org.springframework / spring-beans / jars / spring -. beans -3.2.4.RELEASE.jar
  • grails refresh-dependencies myApplicationDependencies.xml The resulting file is at http://pastebin.com/5bG9Vv78 .
    • Manually removed release 3.1.2 spring - beans and other spring cans from my maven repository, as it was indicated in the dependencies. Maven just solves it though.
    • Switching the dependency converter to ivy and receiving a dependency report. Version 3.1.2 spring is listed as "evicted."

Both my colleague and I have Mac OS X Mavericks and the latest version of Java. Any thoughts are welcome.

UPDATE I also double-checked that my project did not contain duplicate classes. To do this, I ran grails dev war and used jar scan with the -double flag to find duplicate classes. Nothing found.

Again, I'm sure the system is not really trying to throw a NoUniqueBeanDefinitionException. I think he is just trying to find this class and cannot for some reason.

 ---------------------------------------------- Scanned archives: 2 Errors: 0 Archives with hits: 0 
+1
source share
2 answers

There may be a problem with the upper / lower case file name. Check that the names of all the source files are correct names (case of a camel), and there are no files with the same name, but in another case

Question:

 Controllers/MyGreatController.groovy Controllers/MygreatController.groovy 

Otherwise, view the output of the grails dependency report. Make sure that the version of Spring in which your project is running is higher than or equal to 3.2.1, since the version of Spring where the NoUniqueBeanDefinitionException class was added. This class is in the spring - beans module. Also, make sure that none of your other dependencies are pulling an older version of spring - beans.

If so, you can say that Grails ignores this transitive dependency with the exception of the configuration option in BuildConfig.groovy. For example, let's say you pick up a jar with an activated engine from mavenRepo " https://maven.alfresco.com/nexus/content/groups/public/ ". Modify the dependency declaration to exclude spring beans, and you should be right, like rain.

 compile("org.activiti:activiti-engine:5.13") { excludes "spring-beans" } 

See http://grails.org/doc/2.3.1/guide/conf.html#dependencyResolution .

+1
source

I had a dependency (activiti 5.13), which included an older version of the spring-beans module as my own dependency. For some reason, this version won on my Mac, but on other workstations a newer spring banner was replaced. The workaround was to exclude spring - beans from this dependency in my BuildConfig.groovy file.

 ... dependencies { // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg. compile("org.activiti:activiti-engine:5.13") { excludes "spring-beans" } // runtime 'mysql:mysql-connector-java:5.1.16' } 

This prevents Grails from transitively resolving this particular dependency to my dependency.

See the information in the Disabling Transitive Dependency Resolution section at http://grails.org/doc/2.3.1/guide/conf.html#configurationsAndDependencies .

0
source

All Articles