[#12581] - Date operation not defined on latest groovy version (2.5.7)

Category:
Bug report
Priority:
High
Status:
Feedback Requested
Project: Severity:
Major
Resolution:
Reopened
Component: Reproducibility:
Always
Assigned to:
0

After migrate from JasperServer v 6.4.2 to 7.5 a lot of our job that have some date parameter with default expression are not executing anymore.
We have found this error on log:

Caused by: groovy.lang.MissingMethodException: No signature of method: java.util.Date.minus() is applicable for argument types: (Integer) values: [3]
Possible solutions: find(), find(groovy.lang.Closure), is(java.lang.Object), any(), print(java.lang.Object), use([Ljava.lang.Object;)
.........................

It same that latest version 7.5 have groovy lib version 2.5.7 that are not accepting date operation anymore.

https://stackoverflow.com/questions/58214893/date-plus-not-working-in-2-...

In version 6.4.2 that had groovy 2.4.5 it execute without any error

How to solve it without modify all our ~400 reports?
It possible to downgrade to previous groovy withous problem? or to re-define date aritmatic operator in new groovy version?

Thanks

v7.5.0
Engine util
lachinaa's picture
Joined: Apr 2 2012 - 5:41am
Last seen: 3 days 9 hours ago

4 Comments:

#1
  • Resolution:Open» Fixed

I've found that in your 7.5 installation is missing groovy-dateutil-2.5.7.jar !
Adding it in tomcat/webapps/jasperserver/WEB-INF/lib now date operation work.

#2
  • Resolution:Fixed» Reopened
  • Assigned:nobody» andrews
#3
  • Status:New» Feedback Requested

Hi,

Can you provide us with the JRXML so that we can reproduce it on our side too?

Thanks,
Teodor

#4
  • Assigned:nobody»

I have the same issue:

I try to add 90 days to the given Date input. This is the main error:

2020-10-01T09:32:08,471 ERROR GenericExceptionMapper,http-nio-8080-exec-2:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date() + 90 : $P{to})

and this seems to be the cause:

Caused by: groovy.lang.MissingMethodException: No signature of method: java.util.Date.plus() is applicable for argument types: (Integer) values: [90]
Possible solutions: parse(java.lang.String), split(groovy.lang.Closure), use([Ljava.lang.Object;), is(java.lang.Object), wait(), clone()

I checked my folder (/opt/bitnami/tomcat/webapps/jasperserver/WEB-INF/lib/). There is a "groovy-datetime-2.5.7.jar".

There is a related issue. Sadly I do not know how to help myself with the answer: "You must set groovy language at Report Unit". I am very new to JasperServer...

https://community.jaspersoft.com/questions/1172171/input-date-days-does-...

Feedback
randomness