How to install custom expression on server

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email with questions or issues requiring TIBCO review or response.

I created a custom expression function by following the instructions here:  

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?

jphiloon's picture
Joined: Nov 9 2017 - 6:19am
Last seen: 4 years 1 week ago

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$


jphiloon - 4 years 4 months ago

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.

sergey.vishnevetskiy's picture
Joined: Jan 2 2018 - 10:13am
Last seen: 2 years 1 month ago

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>

jphiloon's picture
Joined: Nov 9 2017 - 6:19am
Last seen: 4 years 1 week ago