B4J Library [B4X] Log Server

stevel05

Expert
Licensed User
Longtime User
V1.10 Client Library updated to work with Non_UI apps in java 9+
 

IslandMedic

Member
Licensed User
Longtime User
Ok that error has gone away now. Thank you for working on this with me. I was feeling a bit crazy because I know I saw a sql lite error and then it went away. I was able to reproduce the error. This error happens right away when I start the app.

If I have an existing blah.db file in my objects folder and then run my ap with your v1.10 LIB activated I get the following error:

B4X:
2019-12-23 12:26:39.619:INFO::main: Logging initialized @162ms to org.eclipse.jetty.util.log.StdErrLog
failed to remove existing native library file: C:\Users\I59100~1\AppData\Local\Temp\sqlite-unknown-sqlitejdbc.dll
java.sql.SQLException: [SQLITE_NOTADB]  File opened that is not a database file (file is encrypted or is not a database)
    at org.sqlite.DB.newSQLException(DB.java:383)
    at org.sqlite.DB.newSQLException(DB.java:387)
    at org.sqlite.DB.throwex(DB.java:374)
    at org.sqlite.NestedDB.prepare(NestedDB.java:134)
    at org.sqlite.DB.prepare(DB.java:123)
    at org.sqlite.PrepStmt.<init>(PrepStmt.java:42)
    at org.sqlite.Conn.prepareStatement(Conn.java:404)
    at org.sqlite.Conn.prepareStatement(Conn.java:399)
    at org.sqlite.Conn.prepareStatement(Conn.java:383)
    at anywheresoftware.b4j.objects.SQL.ExecQuery2(SQL.java:365)
    at anywheresoftware.b4j.objects.SQL.ExecQuerySingleResult2(SQL.java:420)
    at anywheresoftware.b4j.objects.SQL.ExecQuerySingleResult(SQL.java:409)
    at b4j.example.pushshared._createpushtables(pushshared.java:35)
    at b4j.example.pushshared._init(pushshared.java:58)
    at b4j.example.main$ResumableSub_AppStart.resume(main.java:120)
    at b4j.example.main._appstart(main.java:71)
    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:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.main(main.java:28)
main.main (java line: 28)
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.main(main.java:28)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:496)
    at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:450)
    at anywheresoftware.b4a.BA.handleUncaughtException(BA.java:164)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
    ... 2 more
Caused by: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:120)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:487)
    ... 5 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
    at b4j.example.logserverclient._messagecolorto(logserverclient.java:669)
    at b4j.example.logserverclient._messageto(logserverclient.java:686)
    at b4j.example.main._application_error(main.java:63)
    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:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    ... 6 more

If I delete the blah.db table and re create the db with your v 1.10 LIB activated it DOES NOT throw the error. Will let you know if I find out any more info.


Here is my initialization

#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: true
#AdditionalJar: sqlite-jdbc-3.7.2
#AdditionalJar: bcprov-jdk15on-159
'Version Dec 22 2019 1736

#End Region

I am using dbutils library for all my sql calls to sql lite.

I also have this code...

B4X:
' needed for ssl connections
    TempDir = File.Combine(File.DirApp, "temp")
    If File.Exists(TempDir, "") = False Then
        File.MakeDir(TempDir, "")
    End If

[/CODE

The reason I included this, in the error it talks about a temp directory.  Just thought it might be usefull.

Brad
Brad
 

stevel05

Expert
Licensed User
Longtime User
Are you sending a log from The Application_Error sub in the Main module?
 

stevel05

Expert
Licensed User
Longtime User
Log server doesn't store anything to the PC via the library neither does it use SQLite.

It uses the jRandomAccessFile library for its B4xSerializator and AsyncStreams classes, but does not use any file access. I am at a loss to see where there could be conflict.

When you say you get the error with the lib activated, does that mean just loaded or connected, or connected and sending messages?

You said you are running a server, is that the app you are adding Logserverclient to? what ports are in use by the existing server?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…