B4J Question B4JPackager11 Issue with XStream

Philip Chatzigeorgiadis

Active Member
Licensed User
Longtime User
My App runs fine from the IDE.
After packing with B4JPackager 11, i get this error, which seems related to xstream library.

B4X:
D:\ALLDOCS\JAVAPROGRAMS\JAVA11PACKBUILDS\BOXGRAPHICS\bin>java.exe @release_java_modules.txt  -m b4j/b4j.example.main
showreport._repshow (java line: -1)
java.lang.ExceptionInInitializerError: Cannot access defaults field of Properties
        at b4j/com.thoughtworks.xstream.converters.collections.PropertiesConverter.<clinit>(Unknown Source)
        at b4j/com.thoughtworks.xstream.XStream.setupConverters(Unknown Source)
        at b4j/com.thoughtworks.xstream.XStream.<init>(Unknown Source)
        at b4j/com.thoughtworks.xstream.XStream.<init>(Unknown Source)
        at b4j/com.thoughtworks.xstream.XStream.<init>(Unknown Source)
        at b4j/ro.nextreports.engine.XStreamFactory.createXStream(Unknown Source)
        at b4j/ro.nextreports.engine.util.ReportUtil.loadReport(Unknown Source)
        at b4j/ro.nextreports.integration.ReportSupport.loadReport(Unknown Source)
        at b4j/ro.nextreports.integration.ReportExec.reportPrepAndRun(Unknown Source)
        at b4j/b4j.example.showreport._repshow(Unknown Source)
        at b4j/b4j.example.main._btnpallets_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)

I found this suggestion (about adding this: permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; ) in a rather old thread here:


but I have no idea how I could implement and test it.
 
Last edited:

Philip Chatzigeorgiadis

Active Member
Licensed User
Longtime User
Looks like a problematic library. What do you need it for? The solution in that link will not help with newer versions of Java.
The xstream library is used by the nextreports-engine library, which is the basis for the B4JNextreports library.
It has been working fine with Java 8. It still works fine with OpenJDK11 for non-UI applications and UI applcations running from the B4J IDE.
The problem only appears after packing a UI app with B4JPackager11.
I tried visiting the Next-Reports support forum to see if any similar problem has been reported, but the forum has been discontinued.
 
Upvote 0

Philip Chatzigeorgiadis

Active Member
Licensed User
Longtime User
Looks like a problematic library. What do you need it for? The solution in that link will not help with newer versions of Java.
Erel, can you please confirm that no solution can be suggested?
If so, I should start looking for alternative methods to create reports, instead of Next-Reports.
Thanks.
 
Upvote 0
Top