B4J Question [SORTED] Errors only on Standalone version

IndieDev

Active Member
Licensed User
Hi,

I am compiling a B4J program using MS Access.
Using similar code as in Opening MS Access databases (mdb)

When executing in Release mode, it runs fine.
Only the Standalone version exits with errors.

These errors display on executing run_debug.bat

B4X:
 Init sql connection...
main$MyOpener.open (java line: -1)
java.lang.ExceptionInInitializerError
        at b4j/com.healthmarketscience.jackcess.impl.GeneralLegacyIndexCodes.getCharHandler(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.GeneralLegacyIndexCodes.writeNonNullIndexTextValue(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.IndexData$GenLegTextColumnDescriptor.writeNonNullValue(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.IndexData$ColumnDescriptor.writeValue(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.IndexData.createEntryBytes(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.IndexData.access$4000(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.IndexData$EntryCursor.beforeEntry(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.IndexCursorImpl.findPotentialRow(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.IndexCursorImpl.findFirstRowByEntryImpl(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.IndexCursorImpl.findFirstRowByEntry(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.DatabaseImpl$DefaultTableFinder.findRow(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.DatabaseImpl$TableFinder.findObjectId(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.DatabaseImpl.readSystemCatalog(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.DatabaseImpl.<init>(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.DatabaseImpl.open(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.DatabaseBuilder.open(Unknown Source)
        at b4j/b4j.pk.syslog.main$MyOpener.open(Unknown Source)
        at b4j/net.ucanaccess.jdbc.DBReference.<init>(Unknown Source)
        at b4j/net.ucanaccess.jdbc.DBReferenceSingleton.loadReference(Unknown Source)
        at b4j/net.ucanaccess.jdbc.UcanaccessDriver.connect(Unknown Source)
        at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
        at b4j/anywheresoftware.b4j.objects.SQL.Initialize2(Unknown Source)
        at b4j/b4j.pk.syslog.main._database_init(Unknown Source)
        at b4j/b4j.pk.syslog.main$ResumableSub_AppStart.resume(Unknown Source)
        at b4j/anywheresoftware.b4a.keywords.Common$2$1.run(Unknown Source)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        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)
Caused by: java.lang.RuntimeException: failed loading index codes file com/healthmarketscience/jackcess/index_codes_genleg.txt
        at b4j/com.healthmarketscience.jackcess.impl.GeneralLegacyIndexCodes.loadCodes(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.GeneralLegacyIndexCodes$Codes.<clinit>(Unknown Source)
        ... 33 more
Caused by: java.io.IOException: Could not load jackcess resource com/healthmarketscience/jackcess/index_codes_genleg.txt        at b4j/com.healthmarketscience.jackcess.impl.DatabaseImpl.getResourceAsStream(Unknown Source)
        ... 35 more

The JAR file executes fine using:
jar command line:
D:\_DEV\jdk-14.0.1\bin\javaw --module-path "D:\_DEV\jdk-14.0.1\javafx\lib" --add-modules ALL-MODULE-PATH -jar pkSysLog.jar

Could anyone kindly help out here please?

B4J version: 9.80
JDK version: 14.0.1


Additional jars used:
B4X:
      #AdditionalJar: ucanaccess-5.0.1
    #AdditionalJar: commons-lang3-3.12.0
    #AdditionalJar: commons-logging-1.2
    #AdditionalJar: hsqldb-2.5.0
    #AdditionalJar: jackcess-4.0.5
    #AdditionalJar: jackcess-encrypt-4.0.2
    #AdditionalJar: bcprov-jdk15on-166
Regards.
 

IndieDev

Active Member
Licensed User
Hi,

Am attaching a sample project and a copy of the Database for testing.
Password for DB: passpass

When compiling in Debug mode, it throws errors:
Errors in Debug mode:
WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
Waiting for debugger to connect...
java.lang.ExceptionInInitializerError
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:427)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.loadClass(LauncherImpl.java:382)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$3(LauncherImpl.java:421)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.RuntimeException: java.net.SocketException: Connection reset
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at b4j.pk.syslog.main.<clinit>(main.java:24)
    ... 12 more
Caused by: java.net.SocketException: Connection reset
    at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:323)
    at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
    at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
    at java.base/java.net.Socket$SocketInputStream.read(Socket.java:982)
    at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
    at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263)
    at java.base/java.io.DataInputStream.readByte(DataInputStream.java:269)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
    ... 14 more
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.NullPointerException
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:458)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
    ... 5 more

It runs fine in "Release" and "Release (obfuscated)" modes.

Standalone package throws errors.

Regards.

PS: The libraries are too large to upload here. so here's a link to download
 

Attachments

  • pkSysLog.zip
    352.8 KB · Views: 110
  • DB.zip
    469.2 KB · Views: 118
Last edited:
Upvote 0

IndieDev

Active Member
Licensed User
I didn't remember it but when I see this line:
B4X:
#AdditionalJar: jackcess-3.0.1-B4J
I know that it is a modified version.
Okay.

Just tried with the old files.
Compiles fine but with some warnings as below.
compile warning:
Global.DBFile3=\\192.168.1.6\SharedFolder\users.accdb
 Init sql connection...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector$1 (file:/Y:/_Projects/B4J/Temp/pkSysLognew/Objects/pkSysLog.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector$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
Loading: com/healthmarketscience/jackcess/index_codes_genleg.txt
Feb 05, 2023 1:01:51 PM org.hsqldb.persist.Logger logInfoEvent
INFO: Checkpoint start
Feb 05, 2023 1:01:51 PM org.hsqldb.persist.Logger logInfoEvent
INFO: checkpointClose start
Feb 05, 2023 1:01:51 PM org.hsqldb.persist.Logger logInfoEvent
INFO: checkpointClose synched
Feb 05, 2023 1:01:51 PM org.hsqldb.persist.Logger logInfoEvent
INFO: checkpointClose script done
Feb 05, 2023 1:01:51 PM org.hsqldb.persist.Logger logInfoEvent
INFO: checkpointClose end
Feb 05, 2023 1:01:51 PM org.hsqldb.persist.Logger logInfoEvent
INFO: Checkpoint end - txts: 1
Feb 05, 2023 1:01:51 PM org.hsqldb.persist.Logger logInfoEvent
INFO: dataFileCache open start
Feb 05, 2023 1:01:51 PM org.hsqldb.persist.Logger logInfoEvent
INFO: dataFileCache open end
 Init sql connection... DONE

But now it does not finish the Standalone package process and displays errors.
Standalone package errors:
B4JPackager11 Version 1.40
Exe name: pkSysLog.exe
build folder: Y:\_Projects\B4J\Temp\pkSysLognew\Objects\temp\build
InputJar: Y:\_Projects\B4J\Temp\pkSysLognew\Objects\pkSysLog.jar
Running: Y:\_Projects\B4J\Temp\pkSysLognew\Objects\temp\FindDosPath.exe
Running: D:\_DEV\jdk-14.0.1\bin\jar
Package name: b4j.pk.syslog
Running: D:\_DEV\jdk-14.0.1\bin\jdeps
.
Exception in thread "main" java.lang.module.FindException: Module java.activation not found, required by java.xml.bind
    at java.base/java.lang.module.Resolver.findFail(Resolver.java:894)
    at java.base/java.lang.module.Resolver.resolve(Resolver.java:191)
    at java.base/java.lang.module.Resolver.resolve(Resolver.java:140)
    at java.base/java.lang.module.Configuration.resolve(Configuration.java:422)
    at java.base/java.lang.module.Configuration.resolve(Configuration.java:256)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration$Builder.build(JdepsConfiguration.java:564)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.buildConfig(JdepsTask.java:603)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:557)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:533)
    at jdk.jdeps/com.sun.tools.jdeps.Main.main(Main.java:49)

Attaching the project here again.

Please see if you can have a go at it.

Regards.

NOTE: Updated the Build Standalone Package errors.
 

Attachments

  • pkSysLog.zip
    352.9 KB · Views: 104
Last edited:
Upvote 0

IndieDev

Active Member
Licensed User
In AppStart, please modify this line to point to the DB file.

In line 58:
Global.DBFile = "\\192.168.1.6\SharedFolder\users.accdb"
 
Upvote 0

IndieDev

Active Member
Licensed User
One more update.

commented the last 3 lines:
    ' SQLite driver                             
    #AdditionalJar: ucanaccess-5.0.0
    #AdditionalJar: hsqldb-2.5.0
    #AdditionalJar: jackcess-3.0.1-B4J
    #AdditionalJar: jackcess-encrypt-3.0.0
    #AdditionalJar: commons-logging-1.2
    #AdditionalJar: commons-lang3-3.8.1
    #AdditionalJar: bcprov-jdk15on-166
'    #AdditionalJar: jaxb-api-2.3.0
'    #AdditionalJar: jaxb-impl-2.1
'    #AdditionalJar: activation-2.2.1

Now, it creates the package, but crashes at start.
Using run_debug.bat, it displays the following errors:
runtime errors:
Y:\_Projects\B4J\Temp\pkSysLognew\Objects\temp\build\bin>java.exe @release_java_modules.txt  -m b4j/b4j.pk.syslog.main
Global.DBFile3=\\192.168.1.6\SharedFolder\users.accdb
 Init sql connection...
main$MyOpener.open (java line: -1)
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
        at b4j/com.healthmarketscience.jackcess.impl.office.AgileEncryptionProvider.<init>(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.OfficeCryptCodecHandler.create(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.CryptCodecProvider.createHandler(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.PageChannel.initialize(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.DatabaseImpl.<init>(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.impl.DatabaseImpl.open(Unknown Source)
        at b4j/com.healthmarketscience.jackcess.DatabaseBuilder.open(Unknown Source)
        at b4j/b4j.pk.syslog.main$MyOpener.open(Unknown Source)
        at b4j/net.ucanaccess.jdbc.DBReference.<init>(Unknown Source)
        at b4j/net.ucanaccess.jdbc.DBReferenceSingleton.loadReference(Unknown Source)
        at b4j/net.ucanaccess.jdbc.UcanaccessDriver.connect(Unknown Source)
        at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
        at b4j/anywheresoftware.b4j.objects.SQL.Initialize2(Unknown Source)
        at b4j/b4j.pk.syslog.main._database_init(Unknown Source)
        at b4j/b4j.pk.syslog.main._appstart(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.raiseEvent(Unknown Source)
        at b4j/b4j.pk.syslog.main.start(Unknown Source)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(Unknown Source)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        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)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        ... 32 more

Regards.
 
Upvote 0

IndieDev

Active Member
Licensed User
I've tried it and it will not work. The jaxb libraries aren't compatible with Java modules system. You will need to distribute it as a jar. You can distribute it together with OpenJDK 11 + JavaFX 11 and start it with a batch file.
Understood.

Thanks a lot for your help. šŸ™‚

Regards.
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
I've tried it and it will not work
HI! both!
After several weeks i managed to compile the standalone package that works with JaXB, i had to use the Jakarta version of the library and used these lines on the IDE:

B4X:
    #PackagerProperty: IncludedModules = jdk.charsets,java.base,java.desktop,java.logging,java.management,java.naming,java.scripting,java.security.jgss,java.sql,java.transaction.xa,java.xml,java.xml.crypto,javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,jdk.unsupported,java.datatransfer,jdk.unsupported.desktop,jdk.jsobject,jdk.xml.dom
    #PackagerProperty: VMArgs = --add-exports java.base/sun.security.x509=b4j --add-opens java.base/sun.security.x509=ALL-UNNAMED --add-exports java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=b4j --add-opens java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED --add-exports java.xml/com.sun.org.apache.xerces.internal.jaxp=b4j --add-opens java.xml/com.sun.org.apache.xerces.internal.jaxp=ALL-UNNAMED --add-exports java.xml/com.sun.org.apache.xpath.internal.jaxp=b4j --add-opens java.xml/com.sun.org.apache.xpath.internal.jaxp=ALL-UNNAMED
    #PackagerProperty: AdditionalModuleInfoString = uses jakarta.xml.bind.JAXBContextFactory;

And these were the jars that i used:
1675701557878.png


I used them to create a library with the SLC and wrapped the libraries in its own jar and added that jar as an #additional jar.

With all these i could use Jaxb.

I know its a different context, but it may help you achieve you what you are trying.
 
Upvote 0

IndieDev

Active Member
Licensed User
HI! both!
After several weeks i managed to compile the standalone package that works with JaXB, i had to use the Jakarta version of the library and used these lines on the IDE:

B4X:
    #PackagerProperty: IncludedModules = jdk.charsets,java.base,java.desktop,java.logging,java.management,java.naming,java.scripting,java.security.jgss,java.sql,java.transaction.xa,java.xml,java.xml.crypto,javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,jdk.unsupported,java.datatransfer,jdk.unsupported.desktop,jdk.jsobject,jdk.xml.dom
    #PackagerProperty: VMArgs = --add-exports java.base/sun.security.x509=b4j --add-opens java.base/sun.security.x509=ALL-UNNAMED --add-exports java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=b4j --add-opens java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED --add-exports java.xml/com.sun.org.apache.xerces.internal.jaxp=b4j --add-opens java.xml/com.sun.org.apache.xerces.internal.jaxp=ALL-UNNAMED --add-exports java.xml/com.sun.org.apache.xpath.internal.jaxp=b4j --add-opens java.xml/com.sun.org.apache.xpath.internal.jaxp=ALL-UNNAMED
    #PackagerProperty: AdditionalModuleInfoString = uses jakarta.xml.bind.JAXBContextFactory;

And these were the jars that i used:
View attachment 138986

I used them to create a library with the SLC and wrapped the libraries in its own jar and added that jar as an #additional jar.

With all these i could use Jaxb.

I know its a different context, but it may help you achieve you what you are trying.
Hi Enrique,

Thank you for this information.

Will try this method.
And will revert back here.

Regards.
 
Upvote 0
Top