Giter Site home page Giter Site logo

node-jasper's People

Contributors

agmoyano avatar dpasqualin avatar eliasful avatar gonzalovinas avatar jromero-onclick avatar kos984 avatar oezi avatar tiagowippel avatar vmlf01 avatar wosubtil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

node-jasper's Issues

but could a more detailed explanation of how to put Jasper Report library in the project directory nodejs?

I tried again to configure this module after a long time and I do not understand it. You closed the issue but in reality did not finish understanding and resolving. It is true that you must allow a relative path as other options. But I can not configure it.

#28 (comment)

var options = {
  path: './lib/jasperreports-6.7.0/', //Path to jasperreports-x.x.x directory (from jasperreports-x.x.x-project.tar.gz)
  reports: {
    // Report Definition
    "name": {
      jasper: './reports/', //Path to jasper file,
      jrxml: './reports/', //Path to jrxml file,
      conn: false, //Connection name, definition object or false (if false defaultConn won't apply or if ´in_memory_json´ then you can pass an JSON object in the ´dataset´ property for in-memory data sourcing instead of database access

    }
  },
  drivers: {
    // Driver Definition
    "name": {
      path: './bin/jdbc/postgresql-42.2.1.jar',//postgresql-42.2.1.jre7.jar //Path to jdbc driver jar
      class: 'org.postgresql.Driver', //Class name of the driver (what you would tipically place in "Class.forName()" in java)
      type: 'postgres'//Type of database (mysql, postgres)
    }
  },
  conns: {
    // Connection Definition
    "name": {
      host: 'localhost', //Database hostname or IP
      port: '5433', //Database Port
      dbname: 'centro_convenciones', //Database Name
      user: 'postgres', //User Name
      pass: 'admin', //User Password
      jdbc: 'jdbc:postgresql://localhost:5433/centro_convenciones', //jdbc connection String. If this is defined, every thing else but user and pass becomes optional.
      driver: 'postgresql'//name or definition of the driver for this conn
    }
  },
  defaultConn: 'pgConvenciones',//Default Connection name
  java: '',//Array of java options, for example ["-Djava.awt.headless=true"]
  javaInstnace: null//Instance of node-java, if this is null, a new instance will be created and passed in 'java' property
 };
var jasper = require('node-jasper')(options);

The path to the jasper report library directory unnziped within the project is: /app-sample/lib/jasperreports-6.7.0/dist

Connection garbage collection

First of all, a big THANK YOU for this module!

I'm using postgresql-9.3-1102.jdbc41.jar for my connection to the database for my reports. During the testing of my Node.js application, I noticed that if I request more reports than the max_connections in the postgresql.conf, I get the following error:


Error running static method org.postgresql.util.PSQLException: FATAL: sorry, too many clients already at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:408) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:181) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection.java:144) at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection.java:29) at org.postgresql.jdbc3g.AbstractJdbc3gConnection.(AbstractJdbc3gConnection.java:21) at org.postgresql.jdbc4.AbstractJdbc4Connection.(AbstractJdbc4Connection.java:31) at org.postgresql.jdbc4.Jdbc4Connection.(Jdbc4Connection.java:24) at org.postgresql.Driver.makeConnection(Driver.java:410) at org.postgresql.Driver.connect(Driver.java:280) at java.sql.DriverManager.getConnection(DriverManager.java:571) at java.sql.DriverManager.getConnection(DriverManager.java:215) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606)

Error: Error running static method
org.postgresql.util.PSQLException: FATAL: sorry, too many clients already
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:408)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:181)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection.java:144)
at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection.java:29)
at org.postgresql.jdbc3g.AbstractJdbc3gConnection.(AbstractJdbc3gConnection.java:21)
at org.postgresql.jdbc4.AbstractJdbc4Connection.(AbstractJdbc4Connection.java:31)
at org.postgresql.jdbc4.Jdbc4Connection.(Jdbc4Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:410)
at org.postgresql.Driver.connect(Driver.java:280)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)

at processConn (/home/mpl/node/svljm/node_modules/node-jasper/index.js:255:19)
at /home/mpl/node/svljm/node_modules/node-jasper/index.js:288:15
at Array.forEach (native)
at jasper.export (/home/mpl/node/svljm/node_modules/node-jasper/index.js:267:10)
at jasper.pdf (/home/mpl/node/svljm/node_modules/node-jasper/index.js:178:21)

Is there a way of terminating connections after the report is sent back to the requester? Or, to re-use a connection?

Thanks!
Mark

net/sf/jasperreports/engine/data/JsonDataSource

I have latest nodejs, npm, I put jasperreports-3.7.1-project (tons of reports have been created for 3.7.1) and mysql-connector-java-5.1.40 in api\controllers\lib, and I got :

var clazz = java.findClassSync(name); // TODO: change to Class.forName when classloader issue is resolved.

Error: Could not create class net.sf.jasperreports.engine.data.JsonDataSource
java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/data/JsonDataSource
Caused by: java.lang.ClassNotFoundException: net.sf.jasperreports.engine.data.JsonDataSource
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
...

Thanks for helping

fillReportSync hangs on OSX

I'm having Java errors with a wide array or errors from java.io, jrloader and some other libraries - I think that these are from configuration issues because they change as I change settings but no matter what FillReportSync always stalls, if I switch to non-sync it continues the program but the callback is never called because the function has still stalled.

I'm running it on Mac OSX 10.10 and have tried JDK 1.6, 1.7 and 1.8 and still no good - what OS and JDK did you build this with so I can match and get the sample working?

Thank you for the library!

How to send multiple datasets using node-jasper library?

I have a task to generate PDFs with nodeJS, so i am working with the node-jasper library.

what i want to know is how can i send multiple datasets in order to fill multiple charts. I can only send one dataset (the main dataset):/

Steps that i followed:

  1. Create a new report and add a piechart and barchart
  2. I also create two datasets in the jasper reports named "dataset1" and "dataset2"
  3. I saved the report as ( "report.jrxml" and build it to get "report.jasper")
  4. In the nodejs part i want to do something like this but i cant find how
var report = {
       report: 'hw',
       data: {
           data1: "test data1", 
           title: "test title"
       },
       dataset1: [
           {
               c: "en",
               x: 'English',
               y: 40,
           },
           {   
               c: 'fr',
               x: 'French',
               y: 60,
           },
       ],
       dataset2: [
           {
               c: "usd",
               x: 'Dollar',
               y: 15,
           },
           {   
               c: 'eu',
               x: 'euro',
               y: 20,
           },
       ]
   }

   var pdf = jasper.pdf(report); 

can you help please ?

in_memory_json

I have a report definition with 'in_memory_json'.
After calling, I get this error:

error: Error creating class
portal-dev-0 (err): net.sf.jasperreports.engine.JRException: 
com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0x74
portal-dev-0 (err):  at [Source: java.io.ByteArrayInputStream@59578c79; line: 1, column: 90]
portal-dev-0 (err):     at net.sf.jasperreports.engine.data.JsonDataSource.<init>(JsonDataSource.java:108)
portal-dev-0 (err):     at net.sf.jasperreports.engine.data.JsonDataSource.<init>(JsonDataSource.java:91)
portal-dev-0 (err):     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
portal-dev-0 (err):     at   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
portal-dev-0 (err):     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
portal-dev-0 (err):     at java.lang.reflect.Constructor.newInstance(Constructor.java:534)

What can I do to avoid this behaviour?
If you need more info, tell me. ;)

Thanks
Robert

garbage collection

Good Morning,

Excellent module, I have the following problem every time I view the report, the application is accumulating memory ram that is having this memory accumulation, I believe he is carrying new instances for each report, how to solve this?

How to set REPORT_LOCALE

I am trying to create reports with locale support. For this to work Jasper requires a java.util.Locale object in REPORT_LOCALE parameter. Is there a way to pass java Locale object in parameters of report?

Problem when using Jasper version > 6.4.0

There is an error when using jasper 6.4.3 and above. Bug is in debug function code:

debug: ['loadJars', function(cb) { if(!options.debug) options.debug = 'off'; var levels = ['ALL', 'TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL', 'OFF']; if(levels.indexOf((options.debug+'').toUpperCase()) == -1) options.debug = 'DEBUG'; var appender = java.newInstanceSync('org.apache.log4j.ConsoleAppender'); var pattern = java.newInstanceSync('org.apache.log4j.PatternLayout', "%d [%p|%c|%C{1}] %m%n"); appender.setLayout(pattern); appender.setThreshold(java.getStaticFieldValue("org.apache.log4j.Level", (options.debug+'').toUpperCase())); appender.activateOptions(); var root = java.callStaticMethodSync("org.apache.log4j.Logger", "getRootLogger"); root.addAppender(appender); cb(); }],

var appender = java.newInstanceSync('org.apache.log4j.ConsoleAppender');
^

Error: Could not create class org.apache.log4j.ConsoleAppender
java.lang.NoClassDefFoundError: org/apache/log4j/ConsoleAppender

PDF no renderiza bien

Saludos, en jasper cuando ejecuto el reporte, me muestra el texto alineado y justificado como lo he programado, pero cuando lo ejecuto desde node, no me funciona ninguna alineación, talvez alguna solución??

Image as a parameter

How to give path to the image parameter??

I want to dynamically add the logo and here is how I tried doing..

data: {
logo:"/home/bishal/Pictures/Nepal.png",
customer: 'Joey Tribbiani',
Date: '19th January 2016',
Our_contact: '+1-9345696978979'
}

How to send data to Jasper Report using Node js?

Hi Agmoyano,

I'm new to Jasper Reports and trying to connect jasper reports with my node js (express) application.
For that, I have tried your node-jasper node module & unfortunately, I'm unable to send data to jasper report because I couldn't understand how that mechanism works.

I'll tell you what I have done in brief.

  1. First of all, I installed your node-jasper module to my express project.
  2. Then I did everything as you have described in your node-jasper Github page. I'm using the Progress OpenEdge database with JDBC. (I have no issue getting data from database)
  3. For creating the Jasper report I used Jasper Studio. By using that I have created employees.jrxml file and added that to the reports directory.
  4. But after starting the server, I got two errors calling that lib and dist folders are missing inside of the jasperreports-6.10.0 library that I have downloaded and put in the express project directory.
  5. Then I have created those two folders. Then I got an error called some jar files missing.
  6. For that, I downloaded all jar files for jasper reports version 6.10.0 from 'https://jar-download.com/artifacts/net.sf.jasperreports/jasperreports/6.10.0' website and put all those jar files in both lib and dist folders that I have created.
  7. Then that error was gone.
  8. But after I'm going to call '/pdf' rest endpoint, the report is created as employee.pdf but without any data. It's only an empty pdf without any content.

Can you help me on how to send data to the jasper report and how to get a pdf output with all contents?

Another question that I have to ask you is, can we do SQL queries inside of the report object as described below instead of calling a dataset?

expressApp.get('/pdf', function(req, res, next) {

var report = {
    report: 'employee',
    data: {
        // id: parseInt(req.query.id, 10),
-------- do a sql query to get data instead of passing json object ----------------------
        secundaryDataset: jasper.toJsonDataSource({
            data: [{ emp_name: "ABCD", nic: "V123456789" }] 
        }, 'data')
    },

--------- do a sql query to get dataset instead of passing json object ------------------
    dataset: [
        {
            emp_name: "ABCD",
            nic: "V123456789"
        },
        {
            emp_name: "EFGH",
            nic: "V987654321"
        }
    ]
}

var pdf = jasper.pdf(report);

res.set({
    'Content-type': 'application/pdf',
    'Content-Length': pdf.length
});
res.send(pdf);

});

Also, what type of outputs can we generate by using node-jasper node module? (Ex: - pdf, csv, etc.)

I have attached my index.js file as index_js.txt, employee.jrxml file as employee_jrxml.txt and some screenshots of the project directory structure.

Thank You!

index_js.txt

employee_jrxml.txt

downloaded and added jar files in dist folder

downloaded and added jar files in lib folder

lib and dist folders in jasperreport-6 10 0 library

project structure

How can i pass Date to report?

Hello, i'm trying to pass Date to my report as "data" parameter, but when i print the parameter in my report, it's null;

In node, i'm converting string to Date object and passing in "data":
image

And in report, i tried to set date parameter as java.uitil.Date, java.sql.Date and java.sql.Timestamp, in any of this cases, the value is printing as null:
image

image

I appreciate it if anyone can help me, thanks.

java.lang.NoClassDefFoundError: org/apache/commons/beanutils/locale/LocaleConverter

Hi @agmoyano,

I'm trying to run a report based on the node js json data you have but I'm encountering this error.
I have tried to follow the setup you have. I'm I missing something on this?

Thank you in advance.

var clazz = java.findClassSync(name); // TODO: change to Class.forName when classloader issue is resolved.
                   ^

Error: Could not create class net.sf.jasperreports.engine.data.JsonDataSource
java.lang.NoClassDefFoundError: org/apache/commons/beanutils/locale/LocaleConverter
Caused by: java.lang.ClassNotFoundException: org.apache.commons.beanutils.locale.LocaleConverter
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)

    at Java.java.import (/home/mythra/Documents/workspace/NodeJS/jasperserver/node_modules/java/lib/nodeJavaBridge.js:227:20)
    at Array.async.auto.imports (/home/mythra/Documents/workspace/NodeJS/jasperserver/node_modules/node-jasper/index.js:177:31)
    at listener (/home/mythra/Documents/workspace/NodeJS/jasperserver/node_modules/async/lib/async.js:490:46)
    at /home/mythra/Documents/workspace/NodeJS/jasperserver/node_modules/async/lib/async.js:441:17
    at _each (/home/mythra/Documents/workspace/NodeJS/jasperserver/node_modules/async/lib/async.js:46:13)
    at Immediate.taskComplete (/home/mythra/Documents/workspace/NodeJS/jasperserver/node_modules/async/lib/async.js:440:13)
    at processImmediate (internal/timers.js:464:21) {
  cause: nodeJava_java_lang_NoClassDefFoundError {}
}

No support for Excel export

I'm looking at the source code and I don't see support for Excel xls export.
Doing some research it seems like we need the JRXlsExporter library. Any plans on incorporating Excel export into this?

Newbie for node-jasper

I am a newbie of Jasper Report + Node.
Now I base on Meteor, Mongo, Vue.
Could has any share/example?

Using Custom Visualization Component not working (PhantomJS)

Hi,

I am struggling using Custom Visualization Components with node-jasper. When try to export some report (witch contains some CVC) it brings the error message: "net.sf.jasperreports.engine.JRRuntimeException: Chrome and/or PhantomJS not properly configured for server side rendering"

PhantomJS is already on the PATH and when exporting on the Studio, it works...

Did anyone already faces the same problem ?

Async/Promise java methods

I've been using this library and it works great. One problem is that it runs synchronously. When I have a long running report, the application locks up until the report is generated.

One use case would be that a report takes 5 minutes to run because of huge database calls. I can't let the application lock up for 5 minutes.

The solution I implemented was very simple, instead of using "callStaticMethodSync" and "fillReportSync", I used their callback variant instead. Well, as you know this can lead to the callback-hell look.

Since I see that you use async in your code, do you know of a better way to transform this code into asynchronous calls?

About how reference to Jasper Reports Library into project structure

Thank you for making available this module, but could a more detailed explanation of how to put Jasper Report library in the project directory nodejs?
Where and how place Jasper Reports Library Folder into project structure?

I downloaded the Jasper Report Library then unzipped and then copy it into a folder that I included in / lib / in the root directory of the project.
At least I interpret the line:
path: '/lib/jasperreports-6.2.1' en:
...
var express = require('express'),
app = express(),
jasper = require('node-jasper')({
path: 'lib/jasperreports-5.6.0',
...

The result is:
Error: ENOENT: no such file or directory, stat '/home/martin/Escritorio/proyecto-consultorio-odontologico/express-starting/node-practica/lib/jasperreports-6.2.1/lib'

I have tried folders and files both jar with Jasper Report Library:

martin @ martin-Satellite-C655: ~ / Desktop / project-office-odontologico / express-starting / node-practice / lib $ dir
jasperreports-6.2.1 jasperreports-fonts-6.2.1.jar
jasperreports-6.2.1.jar jasperreports-javaflow-6.2.1.jar

And I do not understand how to use it

how to choose jasper file in var report

app.get('/pdf', function (req, res, next) {

var report = {
    report: 'name',

// file: xxx.jasper
};

var pdf = jasper.pdf(report);
console.log(pdf);

res.set({
    'Content-type': 'application/pdf',
    'Content-Length': pdf.length
});
res.send(pdf);

});

Jasper Report Node Module (perfx-node-jasper module)

Hi, I am having the error below when trying to run an Express/Node App and I have been able to narrow the problem to my attempt to include Jasper Reporting functionality using the perfx-node-jasper module (https://www.npmjs.com/package/perfx-node-jasper).

For the path in the options object, I used the jasperreports-5.6.1 directory from jasperreports-5.6.1-project.tar.gz.

The Jasper Reporting functionality (using the perfx-node-jasper module) worked successfully on my Windows machine, but when I tried to run the same on a Linux Machine (Centos 6) I get the error below (view the attached log file for more details):

# A fatal error has been detected by the Java Runtime Environment: # # SIGBUS (0x7) at pc=0x00007fac09012f02 , pid=16158, tid=0x00007fac40a19720

JRE version: (8.0_144-b01) (build )

Java VM: Java HotSpot(TM) 64-Bit Server VM (25.144-b01 mixed mode linux-amd64 compressed oops)

Problematic frame: # j java.lang.Object.()V+0

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

An error report file with more information is saved as:

/home/nohaso/node-postgres-promises/hs_err_pid16158.log

View the attached log file for more details:
hs_err_pid905629.log

Problems to install the package. Error message: Python not installed

gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if the py launcher can be used to find Python 2
gyp ERR! find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python checking if Python is C:\Python27\python.exe
gyp ERR! find Python - "C:\Python27\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Python37\python.exe
gyp ERR! find Python - "C:\Python37\python.exe" could not be run
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use

Error:dyld: lazy symbol binding failed: Symbol not found: _JNI_CreateJavaVM

username@namedeMacBook-Pro demo % node app.js
server listen on 3000
dyld: lazy symbol binding failed: Symbol not found: _JNI_CreateJavaVM
Referenced from: /Users/username/Desktop/demo/demo/node_modules/java/build/Release/nodejavabridge_bindings.node
Expected in: flat namespace

dyld: Symbol not found: _JNI_CreateJavaVM
Referenced from: /Users/username/Desktop/demo/demo/node_modules/java/build/Release/nodejavabridge_bindings.node
Expected in: flat namespace

zsh: abort node app.js

Problem to install the package .error message: fatal error: 'jni_md.h' file not found #include "jni_md.h"

username@_username_Book-Pro demo % npm install --save node-jasper

[email protected] install /Users/username/Desktop/demo/demo/node_modules/java
node-gyp rebuild

CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o
In file included from ../src/java.cpp:1:
In file included from ../src/java.h:7:
/Users/username/.jenv/versions/1.8.0.251/include/jni.h:45:10: fatal error: 'jni_md.h' file not found
#include "jni_md.h"
^~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/nodejavabridge_bindings/src/java.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:375:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 20.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/username/Desktop/demo/demo/node_modules/java
gyp ERR! node -v v14.17.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/username/.npm/_logs/2021-08-31T02_43_56_990Z-debug.log

Doesn't work for docx export

I have tweaked your code and made it working for html export but couldn't export for docx as it requires different library and I have tried some stuffs but it doesn't seem to work and didn't know where to contact the author other than this, so.. would you please respond

Example with angular2

Hello,
can I use this component in one project, wrotten in angular2?
If yes, how I can do it?
Thanks

Could you pls provide a example of how to user the dataset attribute in report JSON.

I would love a more detailed example on how to use or declare the dataset in the report JSON

let report = {
        report: 'usersreport',
        data: {
            name: 'Joe'
        },
        dataset: jasper.toJsonDataSource({  how to send this, and how I need to build my jrxml to use the dataser I declare here
            name: 'Joe',
            hola: 'mundo'
        },'data')
    };

Sorry for my english
And please tell me if I can send arrays? and how to do it

[Bug] loadClassSync class not found

After the update to npm Java 0.7.0 this lib installs ok, but when running the basic example of the README this is the error:

/Users/aplicacionesosgroup/Documents/Tests/jasper/node_modules/node-jasper/index.js:151
                cl.loadClassSync(options.drivers[i].class).newInstanceSync();
                   ^

Error: Error running instance method
java.lang.ClassNotFoundException: org.posgresql.Driver
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)

    at Error (native)
    at Array.async.auto.loadClass (/Users/aplicacionesosgroup/Documents/Tests/jasper/node_modules/node-jasper/index.js:151:8)
    at listener (/Users/aplicacionesosgroup/Documents/Tests/jasper/node_modules/async/lib/async.js:490:46)
    at /Users/aplicacionesosgroup/Documents/Tests/jasper/node_modules/async/lib/async.js:441:17
    at _each (/Users/aplicacionesosgroup/Documents/Tests/jasper/node_modules/async/lib/async.js:46:13)
    at Immediate.taskComplete (/Users/aplicacionesosgroup/Documents/Tests/jasper/node_modules/async/lib/async.js:440:13)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)

printing empty table

Hi
I am using jasper for generating pdf documents. In one of the report i have a table and have 'Use Same JDBC connection used to fill master report'. This generates proper report in Jasper Studio. But when i generate pdf in node using 'node-jasper' the table comes empty.
Can someone help me with the issue.

Thanks in advance.. !

JasperReports Library

Hello, I'm trying to implement the Jasper node, but I don't know which jasper library is correct

  • when I use the latest version 6.12.2, it doesn't work, it says that no can find the lib directory Error: ENOENT: no such file or directory

  • When I use a version less than 6, for example version 5.6.0, it works great, but in some cases it doesn't recognize the expressions of the reports like EQUALS($F{CODE}, "0") cause this errornet.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression

I am currently using TIBCO Jaspersoft® Studio 6.6.0, there all my reports work

gyp ERR! stack Error: node-v0.10.37.tar.gz local checksum not match remote

I am unable to install node-jasper.
I get the following error:

gyp ERR! configure error
gyp ERR! stack Error: node-v0.10.37.tar.gz local checksum ecbbcf0d18e35bff4d99685fc5ec88fa2adece95702ac0c1d8a4d07655cb38f6 not match remote a5afad14117bb194731e73b4b6635f36950e9476d3873638856cba8dbb4783a5
gyp ERR! stack at deref (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:299:20)
gyp ERR! stack at IncomingMessage. (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:340:13)
gyp ERR! stack at IncomingMessage.emit (events.js:117:20)
gyp ERR! stack at _stream_readable.js:944:16
gyp ERR! stack at process._tickCallback (node.js:448:13)
gyp ERR! System Linux 3.16.0-23-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/node-jasper/node_modules/java
gyp ERR! node -v v0.10.37
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok

I can render Report

Hello, could you please explain me because I can export my report? When call de endpoint with the function to export jasper to report, java is executed, but not have any response after call jasper.pdf():

var fs = require("fs");
var jasper = require("node-jasper")({
path: "../../lib/jasperreports-6.5.1/",
tmpPath: "../../reports/temp",
reports: {
estados_de_obra: {
jasper: "../../reports/estados-de-obra.jasper",
conn: "in_memory_json"
}
}
});
class ReportesController {
static printEstadosDeObra(req, res, next) {
var reportData = {
report: "estados_de_obra",
data: {},
dataset: [
{
estadoObra: "Terminada",
nombreObra: "Autopista"
},
{
estadoObra: "En proceso",
nombreObra: "Plaza Vieja"
}
]
};
var pdf = jasper.pdf(reportData);
var fileName = "Estados-de-Obra.pdf";
ruta = __dirname + "/reports/" + fileName + ".pdf";
console.log("Before fs.writeFile");
fs.writeFile(ruta, pdf, function(err, result) {
if (err) {
console.log("Error", err);
return next({ status: 450, pathError: req.url, errorCode: err });
} else {
console.log("Result", result, " The file was saved!");
return next(result);
}
});
}
}
module.exports = ReportesController;

Report stuck when running the sample.js

I tried running sample.js and the application does not print the report. It just stuck there with the message bellow.

image

I'm quite new to this. Can anyone guild me to get this working?

Error: libjvm.so ISSUE

Cannot setup Jasper reports in my installation. I have java installed and set JAVA_HOME. Setting LD_LIBRARY_PATH leads to a Segmentation Fault. Please help! This is the error message in my terminal.

module.js:356
Module._extensions[extension](this, filename);
^
Error: libjvm.so: cannot open shared object file: No such file or directory
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/usr/lib/node_modules/node-jasper/node_modules/java/lib/nodeJavaBridge.js:7:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

Save Generated PDF

once the pdf is generated succussfully , How to Save the generated pdf tried a lot options useing node.writefile etc

run report using node-jasper

I have attached my jrxml here .

How do i run this report using node-jasper ? I mean how do i pass 'data: ..' .here . Do you have example for mysql ?

app.get('/pdf', function(req, res, next) {
//beware of the datatype of your parameter.
var report = {
report: 'hw',
data: {
id: parseInt(req.query.id, 10)
secundaryDataset: jasper.toJsonDataSource({
data: ...
},'data')
}
dataset: //main dataset
};
var pdf = jasper.pdf(report);
res.set({
'Content-type': 'application/pdf',
'Content-Length': pdf.length
});
res.send(pdf);
});

..................................................................................................

WHERE
b.date = '2021-11-17'
UNION ALL
SELECT
2 sort,a.batchid,
g.name compname,
c.batchcode,
c.batchvehicleno,
c.date,
d.routename,
a.container,
h.name supname,
b.itmdesc,
a.finaldrc,
a.kgs,
a.liters,
a.metrolac,
a.nh3,
a.remarks,
a.sampledrc,
a.tz,
a.temp,
0 accqty,
0 accltr,
0 dryweightdif,
0 findryweight,
0 fldltr,
0 fldqty,
0 invqty,
0 samdryweight,
' ' vfa,
' ' drc
FROM
batchitempicitem a
INNER JOIN itemmaster b ON
a.companyid = b.companyid AND a.itemmasterid = b.id
INNER JOIN batch c ON
a.batchid = c.id
INNER JOIN route d ON
c.companyid = d.companyid AND c.locationid = d.locationid AND c.routeid = d.id
LEFT OUTER JOIN batchitem e ON
a.companyid = e.companyid AND a.batchid = e.batchid AND a.batchitemid = e.id
INNER JOIN location f ON
a.companyid = f.companyid AND a.locationid = f.id
INNER JOIN company g ON
a.companyid = g.id
INNER JOIN custsup h ON
a.companyid = h.companyid AND h.custsup = 'S' AND e.custsupid = h.id
WHERE
DATE(c.date) = '2021-11-17'
) X
ORDER BY
batchcode,sort,supname,container]]>







































..........................................................

Service Name Problem

The following is the error,
Error: Error running static method
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor.

Error: Could not create class net.sf.jasperreports.engine.JREmptyDataSource

Hi, please need solution por this issues, tray varios structs but no solve problem, I need one estructure complet of proyect for exeute this node-jsaper please

var clazz = java.findClassSync(name); // TODO: change to Class.forName when classloader issue is resolved.
^

Error: Could not create class net.sf.jasperreports.engine.JREmptyDataSource
java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JREmptyDataSource
Caused by: java.lang.ClassNotFoundException: net.sf.jasperreports.engine.JREmptyDataSource
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

at Java.java.import (C:\Users\Cristian Alvarado\Desktop\node-jasper-master\node_modules\java\lib\nodeJavaBridge.js:227:20)
at Array.async.auto.imports (C:\Users\Cristian Alvarado\Desktop\node-jasper-master\node_modules\node-jasper\index.js:176:28)
at listener (C:\Users\Cristian Alvarado\Desktop\node-jasper-master\node_modules\async\lib\async.js:490:46)
at C:\Users\Cristian Alvarado\Desktop\node-jasper-master\node_modules\async\lib\async.js:441:17
at _each (C:\Users\Cristian Alvarado\Desktop\node-jasper-master\node_modules\async\lib\async.js:46:13)
at Immediate.taskComplete (C:\Users\Cristian Alvarado\Desktop\node-jasper-master\node_modules\async\lib\async.js:440:13)
at processImmediate (internal/timers.js:456:21) {

cause: nodeJava_java_lang_NoClassDefFoundError {}

Error: Could not create class net.sf.jasperreports.engine.JREmptyDataSource

Hi, I get an error on using this script :

var express = require('express'), app = express(), jasper = require('node-jasper')({ path: 'reports', reports: { hw: { jasper: 'vehicles.jasper', jrxml: 'vehicles.jrxml', conn: 'in_memory_json' } } }); app.get('/pdf', function(req, res, next) { //beware of the datatype of your parameter. var report = { report: 'hw', data:{}, dataset: _data }; var pdf = jasper.pdf(report); res.set({ 'Content-type': 'application/pdf', 'Content-Length': pdf.length }); res.send(pdf); });

H:\jasper\node_modules\node-jasper\node_modules\java\lib\nodeJavaBridge.js:227
var clazz = java.findClassSync(name); // TODO: change to Class.forName when classloader issue is resolved.
^
Error: Could not create class net.sf.jasperreports.engine.JREmptyDataSource
java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JREmptyDataSource
Caused by: java.lang.ClassNotFoundException: net.sf.jasperreports.engine.JREmptyDataSource
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

at Java.java.import (H:\jasper\node_modules\node-jasper\node_modules\java\lib\nodeJavaBridge.js:227:20)
at Array.async.auto.imports (H:\jasper\node_modules\node-jasper\index.js:176:28)
at listener (H:\jasper\node_modules\async\lib\async.js:490:46)
at H:\jasper\node_modules\async\lib\async.js:441:17
at _each (H:\jasper\node_modules\async\lib\async.js:46:13)
at Immediate.taskComplete (H:\jasper\node_modules\async\lib\async.js:440:13)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)

What can I do ? Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.