pyreportjasper icon indicating copy to clipboard operation
pyreportjasper copied to clipboard

java.lang.ExceptionInInitializerError

Open Mehar-idl opened this issue 1 year ago • 2 comments

Desktop (please complete the following information):

  • OS: ubuntu 22.04
  • Python version 3.8
  • Library version 2.1.1.2
  • Java version jdk 11 jasper studio 6.4.0 ==================error========================= ~/py_jasper_report$ python jasper_server.py 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 org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/home/mehar8119/anaconda3/envs/jasper/lib/python3.8/site-packages/pyreportjasper/libs/groovy-all-2.4.12.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int) WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1 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 An error occurred: Error fill report: Erro fill internal: java.lang.ExceptionInInitializerError

==============================code =========================================

import os
from platform import python_version
from pyreportjasper import PyReportJasper

def advanced_example_using_database():
    # Get the current directory
    current_dir = os.path.dirname(os.path.abspath(__file__))
    
    # Path to the reports directory
    REPORTS_DIR = os.path.join(current_dir, 'reports')
    
    # Path to input and output files
    input_file = os.path.join(REPORTS_DIR, 'csv.jrxml')
    output_file = os.path.join(REPORTS_DIR, 'csv')

    # Database connection details
    conn = {
        'driver': 'mysql',
        'username': 'new_admin',
        'password': '12345',
        'host': 'localhost',
        'database': 'dawlance',
        'port': '3306',
        'jdbc_driver': 'com.mysql.cj.jdbc.Driver',
        'jdbc_dir': '/home/mehar8119/py_jasper_report/mysql Conector/mysql-connector-j-8.0.32.jar/'
    }

    pyreportjasper = PyReportJasper()
    pyreportjasper.config(
        input_file,
        output_file,
        db_connection=conn,
        output_formats=["pdf", "rtf"],
        parameters={
            'python_version': python_version(),
            'StartDate': '2023-10-01',
            'EndDate': '2023-10-01'
        },
        locale='en_US'
    )

    try:
        pyreportjasper.process_report()
    except Exception as e:
        print(f"An error occurred: {e}")

# Call the function to generate the report
advanced_example_using_database()

Mehar-idl avatar Dec 02 '23 08:12 Mehar-idl

An error occurred: Error fill report: Erro fill internal: java.lang.ExceptionInInitializerError Usually, this happens when it fails to populate the report according to the data from the data source. Does the database exist? Does the query table specified in the report exist in the database, along with its fields?

jadsonbr avatar Dec 29 '23 11:12 jadsonbr

Will be closing soon due to lack of engagement.

jadsonbr avatar Apr 15 '24 12:04 jadsonbr