JasperReports Server – Fixing the missing menu for adding file resources

There is an apparent bug in JasperServer Community Edition v4.2.1 where users would not be able to add images and other file resources because the context menu does not appear (see screenshot below). I notice this in both Linux and Windows versions of the server.

To fix this, you have to modify the file actionModel-search.xml in the jasperserver webapp directory. Assuming you are using the embedded Tomcat web server, it will be under Jasper <jasperserver>/apache-tomcat/webapps/jasperserver/WEB-INF. Open the file and find the element with the labelKey RM_NEW_RESOURCE_FILE and comment out the enclosing conditon elements as shown below:

<!–
                        <condition test=”isProVersion”>
                            <condition test=”isSupportedDevice”>
                                <option labelKey=”RM_NEW_DOMAIN” action=”invokeCreate” actionArgs=”SemanticLayerDataSource”
                                        clientTest=”canResourceBeCreated” clientTestArgs=”SemanticLayerDataSource” className=”up”/>
                            </condition>
 –>
<selectAction labelKey=”RM_NEW_RESOURCE_FILE” className=”flyout”
clientTest=”canResourceBeCreated” clientTestArgs=”FileResource” >
<condition test=”isProVersion”>
<option labelKey=”resourceTypes.access.grant.schema” action=”invokeCreate” actionArgs=”FileResource@@accessGrantSchema”
className=”up”/>
</condition>
<option labelKey=”resourceTypes.font” action=”invokeCreate” actionArgs=”FileResource@@font”
className=”up”/>
<option labelKey=”resourceTypes.image” action=”invokeCreate” actionArgs=”FileResource@@img”
className=”up”/>
<option labelKey=”resourceTypes.css.file” action=”invokeCreate” actionArgs=”FileResource@@css”
className=”up”/>
<option labelKey=”resourceTypes.jar” action=”invokeCreate” actionArgs=”FileResource@@jar”
className=”up”/>
<option labelKey=”resourceTypes.jrxml” action=”invokeCreate” actionArgs=”FileResource@@jrxml”
className=”up”/>
<option labelKey=”resourceTypes.olap.schema” action=”invokeCreate” actionArgs=”FileResource@@olapMondrianSchema”
className=”up”/>
<option labelKey=”resourceTypes.resource.bundle” action=”invokeCreate” actionArgs=”FileResource@@prop”
className=”up”/>
<option labelKey=”resourceTypes.style.template” action=”invokeCreate” actionArgs=”FileResource@@jrtx”
className=”up”/>
<option labelKey=”resourceTypes.xml.file” action=”invokeCreate” actionArgs=”FileResource@@xml”
className=”up”/>
</selectAction>
<!–
                        </condition>
 –>

Restart the server and the File context menu should now appear:

Screenshot showing Add Resource->File menu

Hope the above helps.