Android Question [jRDC2] Error using new DBRequestManager.bas file

Bladimir Carrillo

Member
Licensed User
Longtime User
Hello,

I was updated to last B4A 8.0 version, and I want to use the new jRDC2. I was downloaded the latest files (jRDC2.zip and DBRequestManager.bas -4KB-) but I am having the following error when trying to send a request to server...

Error B4A Logs section

ResponseError. Reason: java.lang.ClassNotFoundException: b4j.example.dbe$_dbcommand, Response: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 java.lang.ClassNotFoundException: b4j.example.dbe$_dbcommand</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /rdc. Reason:
<pre> java.lang.ClassNotFoundException: b4j.example.dbe$_dbcommand</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>
</body>
</html>
** Activity (login) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (settings) Create, isFirst = true **
** Activity (settings) Resume **

The code ...

B4X:
    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand("sm_tbl_sel", Array(0,0))
    Dim j As HttpJob
    Dim res As DBResult
    
    Try
        j = req.ExecuteQuery(cmd, 0, Null)
        Wait For(j) JobDone(j As HttpJob)

        If j.Success Then
            req.HandleJobAsync(j, "req")
            Wait For (req) req_Result(res As DBResult)
            'work with result
            req.PrintTable(res)
        End If
            
    Catch
        Log(LastException.Message)
    End Try

Error on server side ...

(ClassNotFoundException) java.lang.ClassNotFoundException: b4j.example.dbe$_dbco
mmand
Command: , took: 344ms, client=186.4.244.152
(ClassNotFoundException) java.lang.ClassNotFoundException: b4j.example.dbe$_dbco
mmand
Command: , took: 0ms, client=186.4.244.152

When using old DBRequestManager.bas file (8KB), all works ok but I have not HandleJobAsync method.


Thank you in advance for your help.
 

DonManfred

Expert
Licensed User
Longtime User
Error 500 java.lang.ClassNotFoundException: b4j.example.dbe$_dbcommand

Seems like you are missing the dbcommand type!?
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
dbcommand type
in the main module in "Process_Globals"
B4X:
Sub Process_Globals
   Type DBResult (Tag As Object, Columns As Map, Rows As List)
   Type DBCommand (Name As String, Parameters() As Object)
   Private const rdcLink As String = "http://192.168.0.6:17178/rdc"
End Sub
 
Upvote 0

Bladimir Carrillo

Member
Licensed User
Longtime User
Thank you (DonManfred and Alexander Stolte)

Finally I was found the problem... When I write the Type declarations (DBResult and DBCommand) in other class module that is not main, jRDC do not run.

Other problem I have now...
No all job requests back to the wait ... job in line method. Why ?

For today I am using the old DBRequestManager.bas (on client side) and new jRDC2 jar on server, and runs ok. Obviuslly without asynchronus functionality.


Regards,
Bladimir
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Finally I was found the problem... When I write the Type declarations (DBResult and DBCommand) in other class module that is not main, jRDC do not run.
From this thread (https://www.b4x.com/android/forum/threads/b4xobject-b4a-b4j-b4i-objects-serialization.48272/#content): "Note that if you plan to share types between different platforms then the types should be declared in the main module."

Other problem I have now...
No all job requests back to the wait ... job in line method. Why ?
Example? Code?
 
Upvote 0
Top