3

I'm getting the NoSuchMethodError on createCriteria method in Grails. I don't know somehow it is not recognizing the method. I have the createCriteria in other projects, but it is not working here.

Domain.where {  }

Above is also not working. Here is my code:

def res = Employee.createCriteria().list {
    or {
        eq('validOn',date)
        eq('day',day)
    }
}
println "res"+res

I'm getting this error:

  Caused by: java.lang.NoSuchMethodError: in.aoo.EmployeeController$_chefPackaging_closure12.<init>(Ljava/lang/Object;Ljava/lang/Object;Lgroovy/lang/Reference;Lgroovy/lang/Reference;)

1 Answers1

0

There can be a few possibilities of this error. The first and most common is that the Employee class is not located under grails-app/domain directory instead located under the src/groovy package.

The second can be that your classpath can have two Employee class in different packages. One must be your domain and another is simple Java or Groovy class. So you must have imported with the wrong package.

Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121