Jasper Reports : Unable to upload jrxml file

Hi @luisfmfernandes,
In my new installation of jasper, am not able to upload the jrxml or the image file. It says ‘Not permitted’. I’ve logged in a administrator and haven’t changed any of the permissions.

Any ideas?

Thanks
Krithi

Hi @krithi_ramani.

Check doctype Jasper Reports for Permission Rules. Administrator has to have checked read, write, create and delete for level 0 and read and write for level 1 and 2.

Yes, they are set by default…never changed them

Hi.

I don’t know how can i help you!. When i do a fresh install everything run as expected.

Let me know if you have more info.

Thanks,
Luís.

Hello,

i see the same behaviour on a fresh installation:

-No error in the frappe console output
-New report doesn`t show up in the list of Jasper Reports
-New report shows up in the corresponding doctype but cant be used: “The report is missing.”
-Permissions are default and as suggested here

I thought i could “hack” it into the Database, just to be able to generate my first report, by entering the full report-path into the field jasper_report_path but i still got “The report is missing.”

Can someone, maybe @luisfmfernandes, give me a tip how i can debug this issue?

Thanks, David

Hi @itsdave.

If the report shows up in doctype but you get “report is missing” then you must check if everything is ok with your report. You must give me more info then i can tell you how to debug it.

If you can see your report in doctype then your report compile and everything is ok.

With the info that you give me now, for me, everything is ok. Because when you login jasper report get every report that you have access (and in your case you get one), so he find that report, then when you select him you get “report is missing”.

Some suggestions:

  1. See javascript console for more info in the error.
  2. try to start frappe with bench start to see the errors.

Let me know if you solve the problem.

Luis.

Let us know if @krithi_ramani solve the problem!

@krithi_ramani, Did you solve the problem?

You can start by checking if folder frappe-bench/sites/your database folder/jasper exists and if frappe user (the user who issue bench start) can write in it.

Luis.

I`m allready running with bench start and when i try to upload the document, i just see the usual POST command:

23:12:43 web.1                | 192.168.241.184 - - [02/Jan/2016 23:12:43] "POST / HTTP/1.1" 200 -

No errors displayed in here.

In my browsers JS console i see the following error:

Traceback (innermost last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 64, in uploadfile
    is_whitelisted(method)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 118, in is_whitelisted
    raise frappe.PermissionError('Not Allowed, {0}'.format(method))
 PermissionError: Not Allowed, <function file_upload at 0x7f03dd641398>

I`ve tried your Cherry.jrxml file, so i think this should be OK for testing purposes. (but does your app realy validate the jrxml file on upload?)

The folder did not exist. I just created it and set the permissions, but there is no change in the behaviour.

Just to ensure that you get me right:

-I am able to “Make a new Jasper Report” by Jasper Erpnext Report → Jasper Reports → New.
-When i press the save-button the new report is saved in the “tabJasper Reports” mysql table.
(From This moment on i can see the Jasper-Icon in the right corner in the Doctype i wanted it to be.)
-Then the magic of JS makes the upload button appear.
-On pressing the button the upload-windows opens, i can select a local file but when i press the upload button, i get the “Not permitted” dialog, which i have attached as a screenshot.

So i think it should be a problem with the permissions, but as i am able to save the report, i should be able to upload a file with it, too? Why do i see the PermissionError: Not Allowed, <function file_upload at 0x7f03dd641398> ?

I also searched the whole frappe directory for jrxml files, but your examples are the only ones there.

Luis: Let me just say that i realy appreciate your effort. Thank you.

I dont know if its important, but when i try to change permissions or to save the Doctype Jasper Reports without making any changes i get the following error:

Fieldname report_message: cannot have special characters like “:” Did not save

Hi @itsdave.

I fix the error. Please update jasper.
The error was because frappe team made some changes. If you find another errors please let me know!

You should now make the Cherry report test with success. You should import Cherry.jrxml, Cherry.jpg and localizationdemo.properties files.

localizationdemo.properties is necessary because i mention it in Cherry.jrxml (for demo purpose) if you don’t want localization in yours reports then don’t mention localization in your jrxml reports.

Luis.

Great. I am now able to upload the Cherry files. :grin:

But i still have not seen my first generated report. :disappointed:

I have now assingned the Cherry-Report to Doctype Sales-Order (should this work?), but when i try to generate one i get the following error in the frappe-console:

17:52:48 worker.1             | [2016-01-03 17:52:48,777: WARNING/Worker-1] pyjnius is installed: True
17:52:49 worker.1             | java.sql.SQLException: No suitable driver found for
17:52:49 worker.1             |         at java.sql.DriverManager.getConnection(DriverManager.java:596)
17:52:49 worker.1             |         at java.sql.DriverManager.getConnection(DriverManager.java:233)
17:52:49 worker.1             |         at ExportReport.connect(ExportReport.java:310)
17:52:49 worker.1             |         at ExportReport.make(ExportReport.java:118)
17:52:49 worker.1             |         at ExportReport.export(ExportReport.java:174)
17:52:49 worker.1             |         at BatchReport.addToBatch(BatchReport.java:62)
17:52:49 worker.1             | log4j:WARN No appenders could be found for logger (net.sf.jasperreports.extensions.ExtensionsEnvironment).
17:52:49 worker.1             | log4j:WARN Please initialize the log4j system properly.

When i try to download the report, i get an empty, grey square.

In the folder [REPORTNAME]/compiled i can see the Cherry.jasper with about 32k of size and the aditional files, and a cryptic folder for everytime i try to create a Report.

Each of this folders contains only one Cherry.html with the following content:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <style type="text/css">
    a {text-decoration: none}
  </style>
</head>
<body text="#000000" link="#000000" alink="#000000" vlink="#000000">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td width="50%">&nbsp;</td><td align="center">

<![if IE]>
<script>
var links = document.querySelectorAll('link.jrWebFont');
setTimeout(function(){ if (links) { for (var i = 0; i < links.length; i++) { links.item(i).href = links.item(i).href; } } }, 0);
</script>
<![endif]>
</td><td width="50%">&nbsp;</td></tr>
</table>
</body>
</html>

Seems like java don’t find the driver to connect to mysql/mariadb. I add mysql driver connector, just to be sure, but i don’t think this will solve the problem. Don’t heart to try! So please update again!

The jar files needed to jasper work are in jasper_erpnext_report/java/lib/ folder. It has by default mariadb driver included, and this folder is added to classpath by jasper_erpnext_report on startup and before pyjnius start in jasper_erpnext_report/jasper_reports/__init__.py.

If this don’t work try to find out why it is not finding the java/lib folder. Set java CLASSPATH in ~/.bashrc or .bash_profile or other file.

Cherry report is prepared to work with User doctype because it will get username and email.

Let me know if this work!

Luis.

Hi @luisfmfernandes,
Jus bk after vacation. Will update jasper and confirm. It seems to have worked for itsdave!

Krithi

Hi @krithi_ramani.

Wellcome, happy new year!

Let me know if you can now make reports.

Luis.

You too Luis! :slight_smile:

Couple of issues:

  1. Earlier, when I created a report and tried to upload the jrxml, it did not allow me to. The report has been saved in the db, but not listed in the Jasper Reports list. So, after pulling your fix, I tried to create a new report with the same name, it says ‘Duplicate entry…’. So I went to the db and deleted the old entry. Now when I create a new report with the same name, it says ‘Import logo.png image for report COA first.’ Not sure why it is looking for this image file even before I save the form. The upload button is not visible yet(as I cudn’t save the form), so I can’t upload the image anyways.

  2. When I create a new report with a different name, I save it the first time and upload the jrxml file. Now, the ‘save’ button is not visible and if I say ‘Ctrl+S’ I get ‘No permission to ‘Save’ Jasper Reports’. I never changed any of the permissions after pulling your fix.

Appreciate your help!

Thanks
Krithi

@krithi_ramani i think your point 2. is the normal behaviour.

The uploaded files should be visible at the left side as attachments.

I think theres no need to press the save button again.

@luisfmfernandes thanks again, i will give it a try this evening.

@itsdave,
No, it isn’t. On uploading the jrxml and only after saving the form, will the query and the parameters get displayed.

If this is the case, then i`m for the same issue. Save button only works one time in my installation, too.

Hi,
i`ve updated and tested, and its still quite the same.

I`ve also set the CLASSPATH according to your sugestions in multiple files.

The thing that @krithi_ramani pointed out lead me to one detail: There is no connection string at the end of the error message: “JavaException: JVM exception occurred: No suitable driver found for”

So maybe its not the missing db driver but wrong syntax (or empty connection string)?

So i guess we are indeed missing a final save function which reads out the report parameters an maybe specifies the connection parameters?

.