Bug? Error in Debug mode B4J Version 2.8

swissmade

Active Member
Licensed User
Hi all
With version 2.8 from B4J I get error when I start the application in Debug mode.
I had this problem not with version 2.5
Waiting about 1 minute solve this.
In runtime there is nothing wrong.

Maybe somebody has any idea.

see error
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$148(LauncherImpl.java:327)
at com.sun.javafx.application.LauncherImpl$$Lambda$43/1851691492.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(PlatformImpl.java:323)
at com.sun.javafx.application.PlatformImpl$$Lambda$45/1555093762.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/1544628862.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/379110473.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java:102)
at com.sun.glass.ui.win.WinApplication$$Lambda$37/1268447657.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.net.SocketException: Socket closed
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82)
at tcp.server.main.<clinit>(main.java:17)
... 16 more
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
at java.io.DataInputStream.readByte(DataInputStream.java:265)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:217)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156)
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:483)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
... 18 more
java.lang.reflect.InvocationTargetException
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:483)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:358)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:303)
... 5 more
 

Erel

Administrator
Staff member
Licensed User
Does it happen with all your projects? Try to create a new project and run it.
 

swissmade

Active Member
Licensed User
No I don't see this in other projects.
I have the idea that it is a memory size problem.
The Project I'm working on is big.
What I see if I start in Debug mode most of the time I get this Error.
Switch to Release mode and wait 10 secondes without running and set it Back to Debug mode and Run the Code its working again.
This I must do over and over again.
 
Last edited:

Erel

Administrator
Staff member
Licensed User
Hard to say without seeing the project. Make sure not to run any code in process_globals sub.
 

swissmade

Active Member
Licensed User
Hard to say without seeing the project. Make sure not to run any code in process_globals sub.
Maybe this was the issue

T2.Initialize()
InfoUser.Initialize()
DoorLog.Initialize()
TestGrouptype.Initialize()
I had this in process_globals sub
Move this has no effect.
Ther is no code in Process Global.
 

Erel

Administrator
Staff member
Licensed User
Note that in the new version it should warn you about these calls.
 

swissmade

Active Member
Licensed User
This is my Process Global

B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
   
    Private APPVersion As String = "Version Beta 2.6 TR"
    Private APPName As String = "AXcesso Server"
    Private APPClientName As String = "AXcesso Client"
    Private APPAutor As String = "© RS Support 2014-2018"

    Private lblIP As Label
    Private ImageView1 As ImageView
    Private lblstatus As Label
'****** Server Part ***************   
    Private AXServer As ServerSocket
    Private ServerStream As AsyncStreams
'**********************************
    '**** Client Part ***************************************
    Private ClientMAX As Int = 30
    Private SSLClient(ClientMAX) As SocketSSL 'Socket
    Private SSLClientMap(ClientMAX) As Map
    Private SSLStream(ClientMAX) As AsyncStreamsSSL 'AsyncStreams

'*********************************************************
'    Private srvr As Server

    Public VIEW_RECORD As Int, DB_LOGIN As Int, UPDATE_RECORD As Int, _
                COUNT_RECORD As Int, GET_INFO As Int, NEW_RECORD As Int, _
                FILL_IO_ARRAY As Int, PLATE_SEARCH As Int, SELECT_GROUP As Int, SELECT_IO As Int, _
                SAVE_DOOR_LOG As Int, GET_LOG As Int, IS_IN As Int, IS_OUT As Int
    VIEW_RECORD = 1
    DB_LOGIN = 2
    GET_INFO = 3
    NEW_RECORD = 4
    UPDATE_RECORD = 5
    COUNT_RECORD = 6
    FILL_IO_ARRAY = 7
    SELECT_GROUP = 8
    SELECT_IO = 9
    PLATE_SEARCH = 10
    SAVE_DOOR_LOG = 11
    GET_LOG = 12
    IS_IN = 1
    IS_OUT = 3
   
    Private StartUp As Boolean = False

    Private panAXSettings As Node 'For Test Only
'SettingsPart
    Private SettingForm As Form
    Private IniMap As Map

    Private RecordViewMYSQL As String

'DB Fields
'    Private txtMaxLVSettings As TextField
    Private btnTestConnectionSettings As Button
    Private Sock As Socket 'For Testing Connection

'***** Settings Part   
    Private WanPortOK As Boolean = False
    Private txtDBPortSettings As TextField
    Private txtWANPortSettings As TextField
    Private txtWANIPSettings As TextField
    Private txtDATABASEIPSettings As TextField
    Private btnSaveSettings As Button
    Private chkIsServer As CheckBox

   
    Public SendURL As String
    Public SendPort As Int
    Public SendServerPort As String
    Public DBServerPort As String = "0"
    Public DATABASEIP As String
   
'    Public MaxView As String = "20"
    Private SelectString As String
    Private RecordCountNew As Int
    Private RecordCountOld As Int

'Client Login
    Public ClientName As String
    Private HaveLogin As Boolean = False
    Private LoginForm As Form

    Private txtUserName As TextField
    Private txtPassword As TextField
    Private btnLogin As Button
    Private txtRealLoginName As String
'************************************
    Private Msgbox As Msgboxes
   
    Private DialogResponse As DialogResponses

  Private Toast As ToastMessageShow
    Private TimerTable As Timer
    Private BusyUpdate As Boolean = False
    Private BusyNewRecord As Boolean = False
    Private HaveEdit As Boolean = False
'********* Form Part
'    Private FormAdmin As modAdmin
'    Private FormUser As modUsers
'    Private FormIO As modAXcessoIO
'    Private FormLocations As modLocations
'    Private FormGroup As modGroup
'********** Menu *****************
    Private mnuAdmin As MenuItem
    Private mnuDataBaseSettings As MenuItem
    Private mnuIOSettings As MenuItem
    Private mnuUserSettings As MenuItem
    Private mnuUserLocations As MenuItem
    Private mnuGroup As MenuItem
    Private mnuVisitor As MenuItem
    Private RetryCounter As Int = 1
   
    Public txtFreeText1 As String
    Public txtFreeText2 As String
    Public LevelUserIs As String
    Private EmergencyTeamMin As Int
    Private EmergencyTeamPersons As Int

    Private mnuLogin As MenuItem
    Private newLogin As Boolean
    Private lblMessage As Label
'For test only   
    Private UseTCP As Boolean = True
    Private tmpSock As Socket

'Part For the Group and Access Selection
    Type GroupSelect (GroupID As String, Group As String, Client As String, _
            User As String, UserID As String, TagNumber As String, TagText As String, ModuleID As Int, ModuleName As String, _
            ModuleLocation As String, _
            ConX201 As Boolean, ConX202 As Boolean, _
            ConX203 As Boolean, ConX204 As Boolean, _
            UseX201 As String, UseX202 As String, _
            UseX203 As String, UseX204 As String, _
            X101 As String, X102 As String, X103 As String, X104 As String, _
            Monday As String, Tuesday As String, Wednesday As String, Thursday As String, _
            Friday As String, Saturday As String, Sunday As String, TimeGroup As String, _
            TimeX101 As String, TimeX102 As String, TimeX103 As String, TimeX104 As String, _
            FirstCharX201 As  Char, FirstCharX202 As Char, FirstCharX203 As Char, FirstCharX204 As Char, _
            HaveReaderTime As Boolean, APBXReader1 As String, APBXReader2 As String, APBXReader3 As String, APBXReader4 As String, _
            AXConnectX201 As String, AXConnectX202 As String, AXConnectX203 As String, AXConnectX204 As String, Visitor As Boolean)
    Private T2 As GroupSelect

'********* Type for Info User    *****************
    Type UserInfo(UserID As Int, Name As String, UserName As String, Client As String, TagNumber As String, _
            Departement As String, Location As String, Comment As String, RoomNumber As String, Phone As String, Email As String, _
            UserNumber As String, TagActive As Boolean, Emergency As Boolean, TagText As String, FreeTextText1 As String, FreeTextText2 As String, _
            Plate As String, Vehicle As String, Visitor As Boolean, StartDate As String, EndDate As String, _
            StartTime As String, EndTime As String, ContactName As String)
    Private InfoUser As UserInfo

    Type LogInfo(UserImage As ImageView, User As String, DateTimeLog As String, AntiPassback As String, Departement As String, _
        Room As String, Location As String, ReaderName As String, Group As String, EmergencyTeam As Boolean, Message As String, _
        TagNumber As String, Client As String, UserBackColor As Boolean, AntPassBackColor As Boolean, MessageColor As Boolean, _
        Visitor As Boolean, Cars As Boolean)
    Private DoorLog As LogInfo
   
    Type TestForAccesType(str As String, IPUsed As String, PortUsed As String, Tag As String, _
        TagStartWith As Char, SockIndex As Int, Process As Boolean)
    Private TestGrouptype As TestForAccesType

    Private tmpTestGroepType(ClientMAX) As TestForAccesType
    Private klotentimer As Timer

'******** Type for Door opening   
'    Private DoorList As List
'***********************************************
'********  Tag Checks
    Private HaveTag As Boolean = False
'********* Startup AXIO *********
    Private PoolTimer As Timer
    Private BusyPool As Boolean
'*********** Server or not
    Public IsServer As Boolean
'*********** User Info ********
'    Private imgUser As ImageView
    Private lstUserInfo As Label
    Private lstUserImage As ImageView
'*********** Log Info    *********
    Private ServerList As ListView
    Private tblLog As TableView
'******** Settings Form
    Private SettingsFormOpen As Boolean = False

    Private lstMainPresent As ListView
    Private lstMainReaders As ListView
'********* Door Part   
    Private ivDoorImage As ImageView
    Private txtDoorText As Label
    Private lstDoor As List
    Private strDoorMessage As String
    Private WhereIsThisComeFrom As String
'    EmergencyTeam
    Private lstEmergencyTeam As ListView
    Private imgImageEmerg As ImageView
    Private lblEmergencyTeamCount As Label
    Private txtUserDepartementEmerg As Label
    Private txtUserNameEmerg As Label

    Private btnEditLocations As Button
    Private btnEditUsers As Button
    Private btnEditVisitors As Button
    Private btnEditGroups As Button
   
    Private imgPresenceImage As ImageView
    Private txtPresenceText As Label
    Private txtPresenceCount As Label
    Private HaveTagToLog As Boolean
'    Private LogStartUp As Boolean
    Private LastLogDate As String
   
    Private btnEditAdmin As Button
    Private btnEditDatabase As Button
    Private btnEditIO As Button
    Private btnRestartServer As Button
    Private panShortCut As Node
'Tag Info Part   
    Private lstMainTagInfo As ListView
    Private txtTagMessage As Label
    Private chkVisitor As CheckBox

    Private imgImageTag As ImageView
    Private txtTagTime As Label
    Private HaveVisitor As Boolean
    Private LastTag As String
    Public lblLastMessage As Label

'For test only

    Private chkLiveLog As CheckBox
    Private LIVELOG As Boolean
    Private LIVELOGCounter As Int
    Private LIVELOGText As String
    Private ADDTagLogRecordCountOld As Int
    Private OldModuleData As String
    Private ReaderLOGCounter As Int
'messagewindow
    Private Mess As modMessage
    Private MemCleanTimer As Int
    Private ServerRefreshTime As Int
   
    Private chkAutoLogin As CheckBox
    Private AutoLogIn As Boolean
    Private LoginID As String
    Private FromLoginMenu As Boolean
    Private imgAXcesso As ImageView
    Public AXCessoLogo As Boolean
    Public LogoName As String
    Public BrandName As String
'Thread Part
    Private TR As Thread
    Private TRLog As Thread
    Private TRName As String
    Private TRLogName As String 
    Private TRMap As Map
    Private EditGroupUsed As Boolean
End Sub
 

swissmade

Active Member
Licensed User
I think that I found the Problem.

If my Harddisk is very busy then I get this Error Message.

Many thanks for Help.
 

Erel

Administrator
Staff member
Licensed User
If you like send me the complete project and I will try it.
 

swissmade

Active Member
Licensed User
If you like send me the complete project and I will try it.
I can send you the Project but there is need for Mysql and some IO Modules.
The Project is Big.
Can I send this by mail????
I don't like to have this here In the Forum.
 

swissmade

Active Member
Licensed User
Does this error only happens with this project?
At the moment yes.
Maybe the Compiler has too less Memory.
PC has 8GB Windows 7.
When I switch from Debug to Release and Back then most of the time the Application starts.
Also sometimes I like to run in Debug I get the Error Again, waiting for about 1 minute without change the code and start again the application will run.
 

swissmade

Active Member
Licensed User
As it crashes before it starts the MySQL database is less important.
The App will not Crash for Mysql you only get a error message.
If I get the error the App is not reaching AppStart
I will send the Project to your mail.
 

swissmade

Active Member
Licensed User
After some days of working I see, that the Debugger is missing the Breakpoints.
Breakpoints are not working when you start the application in Debug mode.
Breakpoints are working when you place them in a Running Program in Debug mode.

I have the idea that this is only happening with Big programs.
 

swissmade

Active Member
Licensed User
Hi all,
Have anybody also this Issue.
I think its happening with Big Projects.
I like to move to 2.8 but without Debug is this not possible.
 
Top