acesseonline / pyreportjasper

Python Reporting with JasperReports
https://pyreportjasper.readthedocs.io/en/latest/
GNU General Public License v3.0
126 stars 73 forks source link

cant get stock pyreportjasper to run on debian buster #80

Closed matmair closed 3 years ago

matmair commented 3 years ago

Describe the bug after installing the package and running the example repo I get the error: "... is not a valid jrxml file"

To Reproduce Steps to reproduce the behavior: start with debian buster virgin server image

  1. install java with sudo apt-get install openjdk-11-jdk
  2. install with pip3 install pyreportjasper
  3. download the example repo https://github.com/PyReportJasper/exemples_report
  4. run it with python3 run.py
  5. resulting error from function-call pyreportjasper.process_report() NameError: Error fill report: input file: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'isTrue': Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: 'java.lang.Object org.springframework.util.ObjectUtils.unwrapOptional(java.lang.Object)' is not a valid jrxml file:

Expected behavior getting a pdf in reports/csv

Desktop:

Jaspersoft Studio (please complete the following information): used included csv.jxml

Additional context none of the examples seem to work, even with compiling them before with the suggested function / Jaspersoft Studio

jadsonbr commented 3 years ago

This sample repository that you used is obsolete. Here is an example link here

Or be guided by the official documentation Documentation link here

matmair commented 3 years ago

@jadsonbr thank you for your response I got it to run finally by using the right example (provided by you) and by removing all old java-libarys from the lib subdirectory. there were some old .jar there, those cause some strange errors with vanilla openjdk - i have a gradle job that removes them and everthing seems to work now

humbertolopezleon commented 3 years ago

@jadsonbr thank you for your response I got it to run finally by using the right example (provided by you) and by removing all old java-libarys from the lib subdirectory. there were some old .jar there, those cause some strange errors with vanilla openjdk - i have a gradle job that removes them and everthing seems to work now

@matmair What java libraries did you delete? I have this same error and I don't know how to solve it.

jadsonbr commented 3 years ago

@matmair Just delete the old library and install the new one. The library now uses a new concept.

See examples of the new version Examples link

Or be guided by the official documentation Documentation link here

humbertolopezleon commented 3 years ago

@matmair Just delete the old library and install the new one. The library now uses a new concept.

See examples of the new version Examples link

Or be guided by the official documentation Documentation link here

Thanks for your reply. I've been testing the font-calibri-pyreportjasper example and it shows the following error:

OpenJDK 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "org.update4j.DynamicClassLoader"). To use archived non-system classes, this property must be not be set ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show Log4j2 internal initialization logging. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by br.com.acesseonline.classpath.ApplicationClasspath (file:/opt/virtualenvs/python3/src/pyreportjasper/pyreportjasper/libs/acesseonline-1.0.jar) to method java.net.URLClassLoader.addURL(java.net.URL) WARNING: Please consider reporting this to the maintainers of br.com.acesseonline.classpath.ApplicationClasspath WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations OpenJDK 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "org.update4j.DynamicClassLoader"). To use archived non-system classes, this property must be not be set ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show Log4j2 internal initialization logging. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by br.com.acesseonline.classpath.ApplicationClasspath (file:/opt/virtualenvs/python3/src/pyreportjasper/pyreportjasper/libs/acesseonline-1.0.jar) to method java.net.URLClassLoader.addURL(java.net.URL) WARNING: Please consider reporting this to the maintainers of br.com.acesseonline.classpath.ApplicationClasspath WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Traceback (most recent call last): File "main.py", line 23, in contains_image() File "main.py", line 18, in contains_image pyreportjasper.process_report() File "/opt/virtualenvs/python3/src/pyreportjasper/pyreportjasper/pyreportjasper.py", line 182, in process_report raise error NameError: Error fill report: Erro fill internal: net.sf.jasperreports.engine.util.JRFontNotFoundException: Font "Calibri" is not available to the JVM. See the Javadoc for more details.

image

khantechie commented 1 year ago

Is my below code correct am getting log4j2 error

from platform import python_version import pyreportjasper import oracledb from pyreportjasper import PyReportJasper

from pyjasper import JasperGenerator

import os

def advanced_example_using_database(): REPORTS_DIR = "D:\Haroon_Docs\TAC-PROJECT\jasper"

input_file = os.path.join(REPORTS_DIR, 'csv.jasper')

conn = {
'jdbc_driver': 'oracle.jdbc.driver.OracleDriver',
'jdbc_url': 'jdbc:oracle:thin:@10.100.10.16:1521/TACTESTPDB.TAC.LOC',
'jdbc_user': 'PARKING',
'jdbc_pass': 'PARKING123',
'jdbc_dir': 'E:\Ayoub Backup\E'
    }

output = os.path.join(REPORTS_DIR, 'csv')
print(python_version())
jasper = PyReportJasper()
jasper.process(
    input_file,
    output_file=output,
    format_list=["pdf"],
    # parameters={'python_version': '3.7.4'},
    db_connection=conn)

advanced_example_using_database()