I created a custom expression function by following the instructions here: https://community.jaspersoft.com/wiki/jaspersoft-studio-expression-editor-how-extend-it-and-contribute-your-own-functions-part-2-0
This works fine and I can preview a report using the custom expression in JSS 6.5.1. Now, how do I install the expression on the server? I can create and upload a jar, but that in itself is not enough. I see various mention of bundles, spring beans, and so on, but the information seems either outdated or irrelevant. Is there a "Part 3" to the tutorial above that shows how to install the extended expression on the server?
2 Answers:
I'm not using this interface for custom functions. My recomendation would be to write custom java class with needed methods, download jar file to server and use it as scriptlet in report. Example can be found here. Procs of this approach is in scalability.
I got the server working by: a) copying up the jar that contained the custom expression, b) modifying the .jrxml file to import the custom class and c) also qualifying the CCS2HTML expression as per <textFieldExpression><![CDATA[Util.CSS2HTML($F{COMMENT} )]]></textFieldExpression>
The problem as per the log is
2018-02-06 13:44:55,324 ERROR GenericExceptionMapper,http-nio-8080-exec-2:50 - Unexpected error occurs
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. The method CSS2HTML(String) is undefined for the type Comments_1517942694193_850454
value = CSS2HTML(((java.lang.String)field_COMMENT.getValue()) ); //$JR_EXPR_ID=21$