B4J Question Problem using "ckvs.put" using B4J on raspberry pi (SOLVED)

Alex Oscar Hedman

Member
Licensed User
Hello, im having the next problem when running an UI .jar on a raspberry pi 3.
The problem appears at the end of the sub that im attaching next, when I ask for "ckvs.put".

I dont know if its a problem of the ckvs or the IDE, but i tried everything! šŸ˜«

This is the problem on the command window:

Thread is waiting for more than 60 seconds for the previous transaction to complete...
java.lang.Exception: Stack trace
at java.base/java.lang.Thread.dumpStack(Thread.java:1387)
at anywheresoftware.b4j.objects.SQL.startLock(SQL.java:177)
at anywheresoftware.b4j.objects.SQL.ExecNonQuery2(SQL.java:205)
at b4j.example.clientkvs._deletefromqueue(clientkvs.java:163)
at b4j.example.clientkvs._ser_bytestoobject(clientkvs.java:504)
at jdk.internal.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.BA$3.run(BA.java:247)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
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.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
at java.base/java.lang.Thread.run(Thread.java:834)

the code is this one:

B4X:
Sub subcargarasistencia As ResumableSub
    Dim ID As String= LNUM.Get(13)
    Dim sb As StringBuilder
    sb.Initialize
    sb.Append("ASISTENCIA.db")
    If cuantotiene.Length=0 Then cuantotiene=0
    If SQL.IsInitialized Then SQL.Close
    Dim Data() As Byte
    ckvs.RefreshUser ("fitness")
    Data = ckvs.Get("fitness","ASISTENCIA")
    
    Dim DATE As Long=DateTime.NOW
    If Data=Null Then
    Else
        If File.Exists(directorio,sb.ToString)Then File.Delete(directorio,sb.ToString)
        Dim out As OutputStream = File.OpenOutput(directorio,sb, False)
        out.WriteBytes(Data, 0, Data.Length)
        out.Close
    End If
    
    If SQL.IsInitialized Then SQL.Close
    SQL.InitializeSQLite(directorio, sb, True)
    
    Dim m As Map
    m.Initialize
    m.Put("ID", DBUtils.DB_TEXT)
    m.Put("TARJETA", DBUtils.DB_TEXT)
    m.Put("NOMBRE", DBUtils.DB_TEXT)
    m.Put("APELLIDO", DBUtils.DB_TEXT)
    m.Put("FECHA", DBUtils.DB_TEXT)
            
    DBUtils.CreateTable(SQL, "ASISTENCIA", m, Null)
        
    Dim m As Map
    m.Initialize
        
    m.Put("ID", ID)
    m.Put("TARJETA",LNUM.Get(3))
    m.Put("NOMBRE", LNUM.Get(2))
    m.Put("APELLIDO", LNUM.Get(1))
    m.Put("FECHA",DATE)
    
    Dim ListOfMaps As List
    ListOfMaps.Initialize
    ListOfMaps.Add(m)
    DBUtils.InsertMaps(SQL, "ASISTENCIA", ListOfMaps)
            
    cuantotiene=cuantotiene-1
            
    If SQL.IsInitialized Then SQL.Close
    SQL.InitializeSQLite(directorio, sb, True)
    Sleep(500)
        Log("cargo 1er f "&DateTime.time(DateTime.now))
    Try
            Log("BORRANDO")
            Dim sb2 As StringBuilder
            sb2.Initialize
            sb2.Append("DELETE FROM ").Append("DIARIOS").Append(" WHERE "&"ID" &"='"&ID&"'")
            SQL.ExecNonQuery(sb2.ToString)
            
    Catch
        Log(LastException)
    End Try
    Sleep(500)
    
        Log("cargo 2da f "&DateTime.time(DateTime.now))
    If SQL.IsInitialized Then SQL.Close
    SQL.InitializeSQLite(directorio, sb, True)
    
    Dim m As Map
    m.Initialize
    m.Put("ID", DBUtils.DB_TEXT)
    m.Put("TARJETA", DBUtils.DB_TEXT)
    m.Put("NOMBRE", DBUtils.DB_TEXT)
    m.Put("APELLIDO", DBUtils.DB_TEXT)
    m.Put("FECHA", DBUtils.DB_TEXT)
    m.Put("PENDIENTES", DBUtils.DB_TEXT)
            
    DBUtils.CreateTable(SQL, "DIARIOS", m, Null)
        
    Dim m As Map
    m.Initialize
    
    m.Put("ID", ID)
    m.Put("TARJETA",LNUM.Get(3))
    m.Put("NOMBRE", LNUM.Get(2))
    m.Put("APELLIDO", LNUM.Get(1))
    m.Put("FECHA",DATE)
    m.Put("PENDIENTES",cuantotiene)
        
    Dim ListOfMaps As List
    ListOfMaps.Initialize
    ListOfMaps.Add(m)
    DBUtils.InsertMaps(SQL, "DIARIOS", ListOfMaps)
    
    Sleep(500)
    Dim db() As Byte=Bit.InputStreamToBytes(File.OpenInput(directorio,sb.ToString))'lee
    ckvs.Put("fitness","ASISTENCIA",db)
    
        Log("cargo 3ra f "&DateTime.time(DateTime.now))
    Return True
End Sub
 

Alex Oscar Hedman

Member
Licensed User
Hi Erel, thanks for answer

Yes it works on W10 PC properly.
But on raspy in some point of using the software the .jar frozen. I tried different sizes of screen and different jdk's.
I dont know if its something about the JFX or the ckvs
 
Upvote 0

Alex Oscar Hedman

Member
Licensed User
Hey there, it seems that the new version of SQLite worked fine.

But with the only condition that the program must run on start. If you start the soft' on the command window it gets blocked in some point.
For me its not problem bc we need the program running on start.

Thanks for the help!!
 
Upvote 0
Top