Problem in Grails application started suddenly

72 Views Asked by At

I have a Grails 4.0.3 rest api in production running since last year without major problems.

Unfortunately since last week It is in trouble because of some RabbitMQ request in the queue. My applicaion tries to read the queue and this message is show in the application log.

CMBID cannot start processing queue plt.cmbid.requests because of No signature of method: java.util.Date.format() is applicable for argument types: (String) values: [yyyy-MM-dd] Possible solutions: from(java.time.Instant), getAt(java.lang.String), parse(java.lang.String), print(java.io.PrintWriter), print(java.lang.Object)

I started investigating this problem and I saw some devs saying that it is possible to be the Groovy version, but I don't remember where I can check it out.

Could you help me?

Thanks!

2

There are 2 best solutions below

0
Jeff Scott Brown On BEST ANSWER

I started investigating this problem and I saw some devs saying that it is possible to be the Groovy version, but I don't remember where I can check it out.

Could you help me?

There are a number of ways to identify which version of Groovy is being used, including looking at Gradle's dependency report.

By default a Grails 4.0.3 app will use Groovy 2.5.6, but you could have dependencies in your project which change that.

btw... You didn't ask what is causing the format method to be missing, but in likelihood your project does not have a dependency on org.codehaus.groovy:groovy-dateutil.

0
Mike W On

It appears you have some code doing something like

new Date().format('yyyy-MM-dd')

Is it possible that the code has been like this all the time and this is the first time an item on the queue has a certain field set or invoked this area of code?

I believe previous versions of groovy shipped with the various date extensions, now you need to include the date util dependency - https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-dateutil.

Grails version 4.0.3 comes with groovy version 2.5.6 so adding the following to your build.gradle should help

compile 'org.codehaus.groovy:groovy-dateutil:2.5.6'