B4J Question Deployment ClassPath Issue

cjpryor

Active Member
Licensed User
UPDATED with latest information on 11/30/2021

I wrote a B4J program that accesses a legacy embedded Derby database so I can migrate data from that database to my new SQLite database. It also works on Windows, Mac, and Linux when run from B4J (using B4JBridge to connect to the Linux and Mac).

However, when I deploy to Windows, Mac, and Linux (using internal B4JPackager11 for windows, B4JPackager11.b4j project for Linux, and Mac Signer for the Mac) I get a classpath error when the code tries to initialize the SQL connection. So, it seems it must have something to do with my B4JPackager11.b4j project configuration but I cannot figure out what. I suspect I will need some sort of "AdditionalModuleInfoString: " line in my B4JPAckager11.b4j project configuration but I do not know what.

Additional information is provided below. Please remember that it does run from within B4J so I do not think it is the program itself. I am just giving you this information for background purposes.

1. Added to Main:

#AdditionalJar: derby

2. Relevant B4X code (where dbLocation is the location of the database in the system)

sql.Initialize("org.apache.derby.jdbc.EmbeddedDriver", "jdbc:derby:" & dbLocation)

3. Added to additionallibraries\B4X:

derby.jar

4. B4JPackager11.b4j project: (for Linux)

Private InputJar As String = "/home/nmcollector/data/CP_JE_Exp_Deploy/Linux/nmCollectorCP_JE_Exp.jar"
Private AdditionalModuleInfoString As String = ""
Private VMArgs As String = ""

5. Error in deployed Application (Note the path to the database is correct):

Startup failed due to missing functionality for org.apache.derby.iapi.services.stream.InfoStreams. Please ensure your classpath includes the correct Derby software.
ERROR XBM02: Startup failed due to missing functionality for org.apache.derby.iapi.services.stream.InfoStreams. Please ensure your classpath includes the correct Derby software.
at b4j/org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at b4j/org.apache.derby.iapi.services.monitor.Monitor.missingImplementation(Unknown Source)
at b4j/org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
at b4j/org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
at b4j/org.apache.derby.iapi.services.monitor.Monitor.startSystemModule(Unknown Source)
at b4j/org.apache.derby.impl.services.monitor.BaseMonitor.runWithState(Unknown Source)
at b4j/org.apache.derby.impl.services.monitor.FileMonitor.<init>(Unknown Source)
at b4j/org.apache.derby.iapi.services.monitor.Monitor.startMonitor(Unknown Source)
at b4j/org.apache.derby.iapi.jdbc.JDBCBoot.boot(Unknown Source)
at b4j/org.apache.derby.jdbc.EmbeddedDriver.boot(Unknown Source)
at b4j/org.apache.derby.jdbc.EmbeddedDriver.<clinit>(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at b4j/anywheresoftware.b4j.objects.SQL.Initialize2(Unknown Source)
at b4j/anywheresoftware.b4j.objects.SQL.Initialize(Unknown Source)
at b4j/b4j.nmCollector_JE_CP_Migr.dataaccessje._setvvvvvvvvvvvvvvvvvvvvvvvvv4(Unknown Source)
at b4j/b4j.nmCollector_JE_CP_Migr.b4xmainpage$ResumableSub_Button_Export_To_CSV_Click.resume(Unknown Source)
at b4j/anywheresoftware.b4a.BA.checkAndRunWaitForEvent(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.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

dataaccessje._setvvvvvvvvvvvvvvvvvvvvvvvvv4 (java line: -1)
java.sql.SQLException: No suitable driver found for jdbc:derby:/home/nmcollector/Desktop/NMCollectorJE/NMCollectorJE.app/Contents/Resources/nmcswDB
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/anywheresoftware.b4j.objects.SQL.Initialize(Unknown Source)
at b4j/b4j.nmCollector_JE_CP_Migr.dataaccessje._setvvvvvvvvvvvvvvvvvvvvvvvvv4(Unknown Source)
at b4j/b4j.nmCollector_JE_CP_Migr.b4xmainpage$ResumableSub_Button_Export_To_CSV_Click.resume(Unknown Source)
at b4j/anywheresoftware.b4a.BA.checkAndRunWaitForEvent(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.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

Any help is appreciated - please see posts below for more information.

Thanks!
 
Last edited:

cjpryor

Active Member
Licensed User
I verified that the required module is in fact in the B4J generated jar file.

1638194125461.png
 
Last edited:
Upvote 0

cjpryor

Active Member
Licensed User
UPDATE: The windows deployment does not work. I thought it did but was working through it again and discovered it is not. At least the problem is consistent now - it only works in the IDE and NOT when deployed.

I updated my history of posts to reflect that. Still looks like some sort of B4JPackager11 configuration setting to me since it does work in the IDE on Windows, Mac, and Linux.

Thanks
 
Last edited:
Upvote 0

cjpryor

Active Member
Licensed User
Would prefer to have a B4JPackager11 solution but at least I have a workaround that I verified works on Windows and I suspect it will work in Linux as well. The jar file generated using Java 8 is executable on Windows. I simply open a command line window, cd into the directory where the jar resides and issue the following command:

"C:\Program Files\Java\jre1.8.0_301\bin\java" -jar nmCollectorCP_JE_Exp.jar

In my case Java 8 is located at "C:\Program Files\Java\jre1.8.0_301\bin\java" and the executable jar is named nmCollectorCP_JE_Exp.jar.

I tried the same approach for the Mac. Although the jar file (and DMG installer) work just fine I can't seem to get the jar file to pass Apple notarization (using manual code signing since this is java 8 and the B4J MacSigner, which is a wonderful tool, requires at least Java 11 - if not Java 14).

Still looking for a B4JPackager11 solution if possible!

:)
 
Last edited:
Upvote 0
Top