0

I have a Grails app that is pretty vanilla. Domain objects over controllers. Everything runs fine when using locally using run-app or run-war. When I create the WAR file using grails war and deploy to Tomcat 7.0.25 webapps directory, I get the following:

Error 500: Internal Server Error URI/apps2/mriMetricAdjustment/teamResultAdjustment/list Classgroovy.lang.MissingMethodException MessageNo signature of method: com.thrivent.mriAdjustment.domain.TeamResultAdjustment.withCriteria() is applicable for argument types: () values: [] Possible solutions: withCriteria(groovy.lang.Closure), withCriteria(java.util.Map, groovy.lang.Closure), createCriteria()

withCriteria() is a domain method and this error is on all domain objects. I have tried all manner of clean, refresh dependencies, various environment switches on the war build (as in grails prod war). I've totally blown away the app on Tomcat and redeployed. Nothing. I'm working in the Groovy Grails Tool Suite 3.1.0, Grails 2.1.1. Any help would be greatly appreciated.

Adding stack trace and code where issue gets hit. Same place in each controller:

[2013-04-19 16:51:43.931] sysCorpMRIMetricAdjustments ajp-bio-8018-exec-2 ERROR rg.codehaus.groovy.grails.web.errors.GrailsExceptionResolver - error MissingMethodException occurred when processing request: [GET] /apps2/mriMetricAdjustment/teamResultAdjustment/list No signature of method: com.thrivent.mriAdjustment.domain.TeamResultAdjustment.withCriteria() is applicable for argument types: () values: [] Possible solutions: withCriteria(groovy.lang.Closure), withCriteria(java.util.Map, groovy.lang.Closure), createCriteria(). Stacktrace follows: groovy.lang.MissingMethodException: No signature of method: com.thrivent.mriAdjustment.domain.TeamResultAdjustment.withCriteria() is applicable for argument types: () values: [] Possible solutions: withCriteria(groovy.lang.Closure), withCriteria(java.util.Map, groovy.lang.Closure), createCriteria() at com.thrivent.mriAdjustment.controller.TeamResultAdjustmentController.list(TeamResultAdjustmentController.groovy:34) at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:195) at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)

def results = TeamResultAdjustment.withCriteria { and { like("recordStatusCode", "A") like ("teamID", "%" + params.tsID + "%") } }

Updated with a snippet from the log and stack trace of the error. Is there a Tomcat cache that needs to be cleared?

[2013-04-22 08:42:33.414] sysCorpMRIMetricAdjustments ajp-bio-8018-exec-4 DEBUG >ngframework.beans.factory.support.DefaultListableBeanFactory - debug Returning cached >instance of singleton bean 'grailsApplication' [2013-04-22 08:42:33.432] sysCorpMRIMetricAdjustments ajp-bio-8018-exec-4 DEBUG >ngframework.beans.factory.support.DefaultListableBeanFactory - debug Returning cached >instance of singleton bean 'grailsApplication' [2013-04-22 08:42:33.438] sysCorpMRIMetricAdjustments ajp-bio-8018-exec-4 ERROR >rg.codehaus.groovy.grails.web.errors.GrailsExceptionResolver - error >MissingMethodException occurred when processing request: [GET] /apps2/mriMetricAdjustment>/goalAdjustment/list No signature of method: com.thrivent.mriAdjustment.domain.GoalAdjustment.createCriteria() >is applicable for argument types: () values: [] Possible solutions: createCriteria(). Stacktrace follows: groovy.lang.MissingMethodException: No signature of method: >com.thrivent.mriAdjustment.domain.GoalAdjustment.createCriteria() is applicable for >argument types: () values: [] Possible solutions: createCriteria() at >com.thrivent.mriAdjustment.controller.GoalAdjustmentController.list(GoalAdjustmentController.groovy:33) at >grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilte>r.java:195) at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63) at >java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)

` plugins { runtime ":hibernate:$grailsVersion" runtime ":jquery:1.8.0" runtime ":resources:1.1.6"

    // Uncomment these (or add new ones) to enable additional resources capabilities
    //runtime ":zipped-resources:1.0"
    //runtime ":cached-resources:1.0"
    //runtime ":yui-minify-resources:0.1.4"

    build ":tomcat:$grailsVersion"
    //build ":hibernate:$grailsVersion"

    runtime ":database-migration:1.1"

    compile ':cache:1.0.0'
    compile ":grails-ui:1.2.3"
    compile ":yui:2.8.2.1"
    compile ":bubbling:2.1.4"
    compile ":searchable:0.6.4"
    compile ":jquery-ui:1.8.24"
    compile ":jquery-datatables:1.7.5"
    //compile ":hibernate:$grailsVersion"
}`

Last but not least - the catalina logs from when I resinstall the war:

>Apr 22, 2013 11:50:22 AM org.apache.catalina.startup.HostConfig checkResources
>INFO: Undeploying context [/apps2/mriMetricAdjustment]
>Apr 22, 2013 11:50:22 AM org.apache.catalina.startup.HostConfig deployWAR
>INFO: Deploying web application archive /opt/Apache/Tomcat7.0.25/profiles/sysCorpMRIMetricAdjustments/webapps/apps2#mriMetricAdjustment.war
>Apr 22, 2013 11:50:26 AM org.apache.catalina.core.ApplicationContext log
>INFO: Initializing Spring root WebApplicationContext
>Apr 22, 2013 11:50:55 AM org.apache.catalina.core.ApplicationContext log
>INFO: Initializing Spring FrameworkServlet 'grails'
>Apr 22, 2013 11:54:19 AM org.apache.catalina.core.ApplicationContext log
>INFO: Initializing Spring FrameworkServlet 'gsp'
>Apr 22, 2013 11:54:19 AM org.apache.catalina.core.ApplicationContext log
>INFO: GSP servlet initialized

One more update...here are my installed plug-ins:

Plug-ins you currently have installed are listed below:
-------------------------------------------------------------
bubbling            2.1.4            --  Bubbling Library YUI Extension
cache               1.0.0            --  Cache Plugin
database-migration  1.1              --  Grails Database Migration Plugin
grails-ui           1.2.3            --  Grails UI
hibernate           2.1.1            --  Hibernate for Grails
jquery              1.8.0            --  JQuery for Grails
jquery-datatables   1.7.5            --  JQuery DataTables Plugin
jquery-ui           1.8.24           --  jQuery UI resources
resources           1.1.6            --  Resources
searchable          0.6.4            --  Searchable Plugin
tomcat              2.1.1            --  Apache Tomcat plugin for Grails
webxml              1.4.1            --  WebXmlConfig
yui                 2.8.2.1          --  Yahoo! User Interface Library (YUI)
john_solo
  • 25
  • 1
  • 8
  • Added code and stack trace above. – john_solo Apr 19 '13 at 22:40
  • Just for curiosity, if you change to Domain.createCriteria().list(){} it works? –  Apr 20 '13 at 00:31
  • No, if doesn't. I actually changed it from createCriteria once I saw this error. – john_solo Apr 20 '13 at 03:15
  • Does the issue go away in a fresh installation of Tomcat? – codelark Apr 22 '13 at 13:53
  • Since this this the test region at my company I'll not be able to test that out. The issue doesn't go away after several JVM and/or Tomcat restarts. – john_solo Apr 22 '13 at 13:59
  • You are making a call to `withCriteria(Closure)` but the mme is complaining about `withCriteria` taking no arguments. When I've seen this in the past it's been due to not having the hibernate plugin installed in my app - do you maybe have some environment-specific stuff in your dependencies? Does `grails prod run-war` (as opposed to just `grails run-war`, which is dev mode) give the same error? – Ian Roberts Apr 22 '13 at 14:16
  • I will check that now. In the meantime, I've added my plugins section from BuildConfig.groovy – john_solo Apr 22 '13 at 14:52
  • Does hibernate need to be configured somewhere other than BuildConfig.groovy? – john_solo Apr 22 '13 at 15:10
  • Here's an update - looks like the messages.properties isn't getting read, either. I've got a Ajax call back to my controller that reads messages.properties in order to populate a select. That call works, but the list isn't getting populated. – john_solo Apr 22 '13 at 15:49

2 Answers2

0

Please share the code for the domain and controller. It worked for me without any exception.

Steps:

  • Created demoApp
  • Created domain
  • Created controller
  • Used withCriteria from index() action
  • grails war
  • Deployed WAR to Tomcat 7.0.39 (latest)

You can find the details here.

URL to hit:

http://localhost:8080/demoApp-0.1/foo?name=Foo
dmahapatro
  • 49,365
  • 7
  • 88
  • 117
  • 1
    The whole grails app runs fine locally using run-app and run-war, it's only when I generate the war and deploy to Tomcat do I get the error. I have four controllers, all of which use either `createCriteria()` or `withCriteria` and they all have the same result. There must be some kind of weird caching going on. – john_solo Apr 20 '13 at 14:40
  • Here's the error that is thrown with a controller that uses createCriteria (totally different controller): `Error 500: Internal Server Error URI/apps2/mriMetricAdjustment/goalAdjustment/list Classgroovy.lang.MissingMethodException MessageNo signature of method: com.thrivent.mriAdjustment.domain.GoalAdjustment.createCriteria() is applicable for argument types: () values: [] Possible solutions: createCriteria()` – john_solo Apr 20 '13 at 14:58
  • hi @dmahapatro, I am getting one error in the Tomcat server, like the following: Error 500: Internal Server Error URI /dbsync/DatabaseSync/updateAllDBs Class groovy.lang.MissingMethodException Message No signature of method. I just added one new controller Method which calls a new Service mehtod. Everything is running fine in local machines, I have tried in different machines too. Is it a browser cache or TOMCAT cache issue? – ani0904071 Apr 23 '20 at 10:14
  • @ani0904071 I believe it will be better to post your problem as a new question, if you have not done it already, to provide more context and details. Anybody will need more context to look at the problem in hand. I encourage you to post as a new question and add appropriate tags. I have particularly not used Grails for few years now, but if I have time in my hand I will definitely try to answer the question. However, the community is active and anyone can answer your question. – dmahapatro Apr 24 '20 at 13:43
  • HI @dmahapatro, Luckily it was a browser cache problem, clearing cache worked! Thanks for you reply and the previous explanation! – ani0904071 Apr 26 '20 at 06:04
0

So this had nothing to do with the application WAR but rather with the server configuration mismatching against DataSource.groovy. The server was named 'systst' but the environment in the DataSource.groovy was labeled 'syst*e*st.' I suspect that the GORM configurations never happened because the datasource configurations were never loaded. There were no error messages, however I would have thought the Domain objects would have failed since I reference the datasource name in the Domain. Thanks to all!

john_solo
  • 25
  • 1
  • 8
  • hi @john_solo, I am getting one error in the Tomcat server, like the following: Error 500: Internal Server Error URI /dbsync/DatabaseSync/updateAllDBs Class groovy.lang.MissingMethodException Message No signature of method: static java.lang.Math.max() is applicable for argument types: (java.lang.Integer, null) values: [4, null] Possible solutions: max(int, int), max(double, double), max(float, float), max(long, long), min(int, int), wait() I just added one new Controller method which calls a new Service Method. It works fine in my local and another colleague's laptop. – ani0904071 Apr 23 '20 at 10:05
  • See answer. My issue turned to be an issue in the DataSource.groovy. Perhaps you have a similar issue? – john_solo Apr 24 '20 at 18:28