B4J Question B4jPackager11 + Jasper = Error

DarkoT

Active Member
Licensed User
Hi guys...

Need Help... I'm finish with my first more complex project which using B4J desktop app with integrated Jasper report. When I want do distribute my application and using integrated packager for build Win exe, i receive a error:



B4JPackager11 Version 1.21
Exe name: OptDnCheck.exe
InputJar: C:\Work\Vtisk\B4JProjects\OptDnCheck\B4J\Objects\OptDnCheck.jar
Running: C:\Work\Vtisk\B4JPRO~1\OPTDNC~1\B4J\Objects\temp\FindDosPath.exe
Running: C:\Work\Install\Java\jdk-11.0.1\bin\jar
Package name: OptimusCheck.App
Running: C:\Work\Install\Java\jdk-11.0.1\bin\jdeps
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Explicitly excluded modules: [javafx.web]
Included modules: [java.base, java.datatransfer, java.desktop, java.logging, java.management, java.management.rmi, java.naming, java.prefs, java.rmi, java.scripting, java.security.jgss, java.sql, java.sql.rowset, java.transaction.xa, java.xml, java.xml.crypto, javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, jdk.security.auth, jdk.unsupported, jdk.unsupported.desktop, jdk.jsobject, jdk.xml.dom]
Running: C:\Work\Install\Java\jdk-11.0.1\bin\javac
.
.
module-info.java:32: error: package org.codehaus.groovy.plugins does not exist
uses org.codehaus.groovy.plugins.Runners;
^
module-info.java:33: error: cannot find symbol
uses org.codehaus.groovy.runtime.ExtensionModule;
^
symbol: class ExtensionModule
location: package org.codehaus.groovy.runtime
module-info.java:34: error: package org.codehaus.groovy.source does not exist
uses org.codehaus.groovy.source.Extensions;
^
3 errors
how can I add package for groovy.plugins into project? I found similar problem solved by @Erel - here: https://www.b4x.com/android/forum/threads/solved-b4jpackager11-jasperreports-error.115168/page-3

But there is no solution, which will help me... Basicaly - how it's posible to add groovy to project? I try with both possibilities:
#PackagerProperty: IncludedModules = org.codehaus.groovy:groovy-all:2.4.3
#PackagerProperty: AdditionalModuleInfoString = use org.codehaus.groovy:groovy-all:2.4.3;

and received a error...
(sorry, this is my first b4j "not simple" project and need help)...

Thank's DaT
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0

DarkoT

Active Member
Licensed User
Erel hi,
thank you for support... But - i read your suggestion, but this will not help me.. I need groovy inside of Jasper report, because report have some "conditions" which can jasper report solve only when is groove used...
Taking out groove from the project will not be solution... (not for me, sorry)...

I think that solution will be to add package for groovy.plugins to project... Sorry, maybe is really simple, but - I'm new in B4J world (but I'm totally exceeded to be part of this) ;) and I don't know how to use it...

Error: module-info.java:32: error: package org.codehaus.groovy.plugins does not exist

Thanks...
 
Upvote 0

DarkoT

Active Member
Licensed User
There is a missing dependency. I'm not sure which one. This is not a simple library to package.

You can try to open the groove jar file. Look for META-INF\services and remove org.codehaus.groovy.plugins.
Erel, I will attach the groove.jar; because I deleted all dependencies, system now create the exe file, but when I start EXE, system crashed without any logical reasons...

If you can - please take a look on attached JAR; maybe you will find some logic inside...

p.s. Can I send you somehow a Jar file, while is to long for uploading...

Thank you

Br, DAT
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Have you tried to delete this file from groovy.jar?

1621230121485.png


I cannot say whether it will work or not, but it will solve the compilation issue.

The next step is to run the debug.bat file that is created and check the logs.
 
Upvote 0

DarkoT

Active Member
Licensed User
Have you tried to delete this file from groovy.jar?

View attachment 113574

I cannot say whether it will work or not, but it will solve the compilation issue.

The next step is to run the debug.bat file that is created and check the logs.
Yes, i tried it... If I delete org.codaus.groovy.plugins.Runners, ...Extension, the system create a exe file, but when I start EXE (in debug mode), I received a error:

java.lang.IllegalAccessError: superclass access check failed: class TestniReport_1621230474788_166794 (in unnamed module @0x14bfcc0b) cannot access class net.sf.jasperreports.engine.fill.JREvaluator (in module b4j) because module b4j does not export net.sf.jasperreports.engine.fill to unnamed module @0x14bfcc0b
I tried already to input into B4JPackager11 also variable:
Private AdditionalModuleInfoString As String = "exports net.sf.jasperreports.engine.fill;"

And it's same problem... Any other Ideas?!

Regards,
 
Upvote 0

DarkoT

Active Member
Licensed User
Yes, i tried it... If I delete org.codaus.groovy.plugins.Runners, ...Extension, the system create a exe file, but when I start EXE (in debug mode), I received a error:


I tried already to input into B4JPackager11 also variable:
Private AdditionalModuleInfoString As String = "exports net.sf.jasperreports.engine.fill;"

And it's same problem... Any other Ideas?!

Regards,
@Erel - thank you... I found the problem... Basicaly i can not solve the problem when i using inside of Jasper groove language, but - when I switch in Jasper to Java, this will work... Thank you, problem "solved" ;)

Thank you again for your time...
 
Upvote 0

DarkoT

Active Member
Licensed User
Try this:
B4X:
#PackagerProperty: VMArgs = --add-opens b4j/net.sf.jasperreports.engine.fill=ALL-UNNAMED
It goes to MyApp or to B4JPackager11?
 
Upvote 0

DarkoT

Active Member
Licensed User
Your app. Don't use B4JPackager11 directly. Build it with Project - Build standalone package.
Soryy, when I use internal Packager (inside of B4J), I received a error: Error: java.lang.IllegalArgumentException: org.apache.commons.lang.enum: Invalid package name: 'enum' is not a Java identifier

(i found your suggestion how to solve this problem --> open Jar, delete apache/org/lang/enum)... But - When I use internal packager, the system recreates allways new jar...
 
Upvote 0

DarkoT

Active Member
Licensed User
You are modifying the wrong jar. You need to remove the enum folder from the library jar. You only need to do it once.
Erel, sory, but I don't understand... Which library jar should I edit? jar.jar? This file is also always recreated...
Which Jar file is library jar?
 
Upvote 0

DarkoT

Active Member
Licensed User
I'm totally desperate :(
Somehow I created EXE (before I was deleted Enums in created jar.jar and in app.jar, then I create exe with external B4JPackager; internal packager will always recreate my app.jar file...)
And when I start the application, I receive a Error:
java.lang.IllegalAccessError: superclass access check failed: class Dobavnica_SI_1621447346123_698936 (in unnamed module @0x219946f8) cannot access class net.sf.jasperreports.compilers.GroovyEvaluator (in module b4j) because module b4j does not export net.sf.jasperreports.compilers to unnamed module @0x219946f8
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at b4j/net.sf.jasperreports.engine.util.JRClassLoader.loadClass(Unknown Source)
at b4j/net.sf.jasperreports.engine.util.JRClassLoader.loadClassFromBytes(Unknown Source)
at b4j/net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.loadEvaluator(Unknown Source)
at b4j/net.sf.jasperreports.engine.design.JRAbstractCompiler.loadEvaluator(Unknown Source)
at b4j/net.sf.jasperreports.engine.JasperCompileManager.getEvaluator(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.BaseReportFiller.<init>(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRFiller.createBandReportFiller(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRFiller.createReportFiller(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRFiller.fill(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRFiller.fill(Unknown Source)
at b4j/net.sf.jasperreports.engine.JasperFillManager.fill(Unknown Source)
at b4j/net.sf.jasperreports.engine.JasperFillManager.fillReport(Unknown Source)
at b4j/com.prusb.jasperrep.JasperReports.Print(Unknown Source)
at b4j/b4j.example.main._btnmysql_action(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
at b4j/anywheresoftware.b4a.BA$1.run(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Pleeease, need help...

Thank you... DaT
 
Upvote 0

DarkoT

Active Member
Licensed User
And on end - I can still not get the logic - why the system in debug mode (from B4J development "studio" works everything perfect) only by creating the Exe will not work... :(

Confused and disappointed :(
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Which library jar should I edit?
 
Upvote 0

DarkoT

Active Member
Licensed User
Okay, now i move one step forward... I can create EXE inside of B4J (with internal packager)... But the system will not work... When I start app in debug mode I received a error:

java.lang.IllegalAccessError: superclass access check failed: class Dobavnica_SI_1621518798826_431462 (in unnamed module @0x4a316e5) cannot access class net.sf.jasperreports.compilers.GroovyEvaluator (in module b4j) because module b4j does not export net.sf.jasperreports.compilers to unnamed module @0x4a316e5
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at b4j/net.sf.jasperreports.engine.util.JRClassLoader.loadClass(Unknown Source)
at b4j/net.sf.jasperreports.engine.util.JRClassLoader.loadClassFromBytes(Unknown Source)
at b4j/net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.loadEvaluator(Unknown Source)
at b4j/net.sf.jasperreports.engine.design.JRAbstractCompiler.loadEvaluator(Unknown Source)
at b4j/net.sf.jasperreports.engine.JasperCompileManager.getEvaluator(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.BaseReportFiller.<init>(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRFiller.createBandReportFiller(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRFiller.createReportFiller(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRFiller.fill(Unknown Source)
at b4j/net.sf.jasperreports.engine.fill.JRFiller.fill(Unknown Source)
at b4j/net.sf.jasperreports.engine.JasperFillManager.fill(Unknown Source)
at b4j/net.sf.jasperreports.engine.JasperFillManager.fillReport(Unknown Source)
at b4j/com.prusb.jasperrep.JasperReports.Print(Unknown Source)
at b4j/b4j.example.main._btnmysql_action(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
at b4j/anywheresoftware.b4a.BA$1.run(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
 
Upvote 0
Top