Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.ExceptionInInitializerError #150

Open
Mehar-idl opened this issue Dec 2, 2023 · 2 comments
Open

java.lang.ExceptionInInitializerError #150

Mehar-idl opened this issue Dec 2, 2023 · 2 comments

Comments

@Mehar-idl
Copy link

Mehar-idl commented Dec 2, 2023

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()
@jadsonbr
Copy link
Collaborator

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
Copy link
Collaborator

Will be closing soon due to lack of engagement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants