LaVOZs

The World’s Largest Online Community for Developers

'; jasper reports - Unable to delete content resources on JasperReports Server - LavOzs.Com

I'm using JasperReports Server 5.6 and I have some reports deployed there.

The problem starts when I generate a PDF output for my reports. I can see the output file in the repository, but I'm unable to delete it.

I'm able to delete other types of resources, as an image or report, for example. But when I need to delete a generated PDF, the upper options bar doesn't offer me any options (including deleting). If I try to right-click the PDF, it doesn't open any pop-up menus (as it does for images, for example).

The image below shows what happens to the options bar: enter image description here

Here goes some interesting things I've noticed:

  • The type column in the repo tells me the PDF is a "Content Resource". If I manually upload another PDF from my local machine to the repo as a "Content Resource", the UI also doesn't let me delete the resource.
  • I'm logged in as the administrator user. It's set with ROLE_USER and ROLE_ADMINISTRATOR roles (it's the default jasperadmin user).
  • The directory which contains the PDF is set with permissions Read+Write+Delete for the ROLE_USER.
  • Tried to log in as another user with ROLE_USER and I got the same result.
  • The JasperReports Server's tomcat is running as root (it's a test environment).
  • I went through the JasperReports Server's User's Guide and Administrator's Guide. Both said that I need to have the right permissions (and I do), and also I need to have no references to the resources to be deleted. In the case above, where I have an uploaded PDF as a "Content Resource", I don't have any references to it inside the repo, and I still can't delete it!
  • If I delete the super directory that contains the PDF, it works fine.

So, do you guys have any ideas of what I can try to get rid of these PDF outputs?

So far the best solution, I didn't find any better, for this is to use the delete button on the keyboard

I really don't know why is the menu button disabled but nevermind.

I am facing the same problem. There is a work around for this: Use Jaspersoft Studio. Add a JasperReports Server Connection, expand the node and locate the file you wanted, then right-click and select Delete.

This is not an elegance solution but works for the moment.

EDIT - found the problem and have a fix.

The JS is missing "Utils" scope in getInitConfiguration. The original source is:

var Utils = {
restOfString: function(str, fromStr) {
    var from = str.lastIndexOf(fromStr) + fromStr.length;
    return str.substring(from, str.length).trim();
},
getInitOptions: function () {
    return localContext.rsInitOptions || __jrsConfigs__.repositorySearch["localContext"].rsInitOptions;
},
getInitConfiguration: function () {
    return getInitOptions().configuration;
}

};

Just change "return getInitOptions().configuration;" to get "return Utils.getInitOptions().configuration;"

You'll have to make this change in the optimized version of the script (optimized-scripts/results.page.js). Fortunately there are only two occurrences of getInitOptions so it's easy to find and fix the correct one.


The root cause is a javascript error:

uncaught ReferenceError: getInitOptions is not defined

This is coming from results.page.js, but I haven't found a fix for it yet. This code is attempting to change the state of the toolbar buttons. I tried using the latest 6.x version of the script, and that did not fix the problem either.

Also listed at http://community.jaspersoft.com/questions/843951/unable-delete-report-output-jasperserver-56

When you are going to delete the content resource Delete button show disable. I am also experiencing the same problem so for time being I am deleting my content resources by using following query on Jasperserver schema.

Delete from jicontentresource where id in  
(
Select id from jiresource  
where resourcetype='com.jaspersoft.jasperserver.api.metadata.common.domain.ContentResource'
and to_char(update_date,'YYYY-MM-DD') = '2014-11-25');

Delete from jiresource where resourcetype='com.jaspersoft.jasperserver.api.metadata.common.domain.ContentResource'
and to_char(update_date,'YYYY-MM-DD') = '2014-11-25';

You have only to mark all files and then push the Delete-Button

Related
Deleting reports generated by JR Server at scheduled duration
JasperReports Server permissions doesn't work
JasperReports Server cant find sub reports
Resolve JasperReports resource paths from inside an archive (embedded tomcat application)
JasperReports Server: Limit visibility of scheduled jobs to the creator
JasperReports - Embedding chart as SVG into HTML report