Jump to content
We've recently updated our Privacy Statement, available here ×
  • Error java.util.Date.format() is applicable for argument types: (String) values: dd-MMM-yyyy


    asimkin
    • Features: JasperReports Server, Reports Version: v7.5 Product: JasperReports® Server

    Issue Description

    User developed a JRXML report with Groovy language which included a Text field element with expression

    $P{frm_date_pm}.equals(null)? "N/A" : $P{frm_date_pm}.format("dd-MMM-yyyy")
    

    The report worked as expected in TIBCO JasperReports® Server v.7.1, but after upgrade to v.7.5.0 the report fails with error

    No signature of method: java.util.Date.format() is applicable for argument types: (String) values: [dd-MMM-yyyy]
    

    What's the reason of the error and how to fix it?


    Resolution

    The issue related to upgraded Groovy library:

    In TIBCO JasperReports® Server v.7.1, Groovy v.2.4.15 used

    In TIBCO JasperReports® Server v.7.5, Groovy v.2.5.7 used

    Date.format() is a method added by Groovy to java.util.Date.

    Looking at the source, in 2.5.x  methods are not added to java.util.Date by default anymore.

    It's documented in release notes for Groovy 2.5.x:

    Release notes for Groovy 2.5 - Breaking Changes

    The extension methods for the java.util.Date class are now in a separate groovy-dateutil module which isn’t included by default when using the groovy-all pom dependency.

    A possible workaround is to manually place groovy-dateutil-2.5.7.jar library into

    webappsjasperserver-proWEB-INFlib

    and restart the server

    https://dl.bintray.com/groovy/maven/apache-groovy-binary-2.5.7.zip

    Solution tested with TIBCO JasperReports® Server v.7.5.0


    AS-20200324, case 01853647


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...