Grails
  1. Grails
  2. GRAILS-8895

Cannot add Domain class [class xxx.xxx]. It is not a Domain

    Details

    • Type: Bug Bug
    • Status: In Progress
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.1
    • Fix Version/s: None
    • Component/s: Build System, Plugins
    • Labels:
      None
    • Environment:
      Ubuntu 10.4 amd64

      Description

      When modify any groovy file in app plugins, the GrailsConfigurationException throwed, like:

      ERROR StackTrace  - Full Stack Trace:
      org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Cannot add Domain class [class org.codehaus.groovy.grails.plugins.jquery.JQueryProvider]. It is not a Domain!
      	at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:916)
      	at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:615)
      	at org.codehaus.groovy.grails.commons.GrailsApplication$addArtefact.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
      	at org.codehaus.groovy.grails.plugins.DomainClassGrailsPlugin$_closure3.doCall(DomainClassGrailsPlugin.groovy:117)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1237)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
      	at groovy.lang.Closure.call(Closure.java:412)
      	at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.invokeOnChangeListener(DefaultGrailsPlugin.java:784)
      	at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.notifyOfEvent(DefaultGrailsPlugin.java:735)
      	at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.notifyOfEvent(DefaultGrailsPlugin.java:750)
      	at org.codehaus.groovy.grails.plugins.AbstractGrailsPluginManager.informOfClassChange(AbstractGrailsPluginManager.java:381)
      	at org.codehaus.groovy.grails.compiler.GrailsProjectWatcher$2.run(GrailsProjectWatcher.java:224)
      	at org.codehaus.groovy.grails.compiler.GrailsProjectWatcher.firePendingClassChangeEvents(GrailsProjectWatcher.java:114)
      	at org.codehaus.groovy.grails.cli.agent.GrailsPluginManagerReloadPlugin.reloadEvent(GrailsPluginManagerReloadPlugin.java:40)
      	at com.springsource.loaded.TypeRegistry.fireReloadEvent(TypeRegistry.java:1556)
      	at com.springsource.loaded.ReloadableType.loadNewVersion(ReloadableType.java:384)
      	at com.springsource.loaded.TypeRegistry.loadNewVersion(TypeRegistry.java:776)
      	at com.springsource.loaded.agent.ReloadableFileChangeListener.fileChanged(ReloadableFileChangeListener.java:38)
      	at com.springsource.loaded.agent.Watcher.determineChangesSince(FileSystemWatcher.java:141)
      	at com.springsource.loaded.agent.Watcher.run(FileSystemWatcher.java:125)
      	at java.lang.Thread.run(Thread.java:662)
      

      I found that the domainClass plugin will watch every app plugin directories's groovy file, if change the relative WatchPattern, the error gone. And in fact, there are six plugins watch all the app plugin's directories.
      My workaround codes are:

      def pm = org.codehaus.groovy.grails.plugins.PluginManagerHolder.pluginManager;
      for ( plugin in pm.getAllPlugins() ) {
      	for ( wp in plugin.getWatchedResourcePatterns() ) {
      		if ( "plugins" == wp.getDirectory()?.getName() && "groovy" == wp.getExtension() )
      			wp.extension = "groovyXX";
      	}
      }
      

        Activity

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Xiaoxiang Li
          • Votes:
            6 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development