Android Question RDC in Starter not work

fabricio

Member
Licensed User
Longtime User
How to use RDC in the service?

LOG in jRDC server:
(ClassNotFoundException) java.lang.ClassNotFoundException: b4j.example.starter$_dbcommand

Thanks.

Fabricio
 

Attachments

  • TesteRDC.zip
    9.9 KB · Views: 147

fabricio

Member
Licensed User
Longtime User
Result from any command:

B4X:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /rdc. Reason:
<pre>    java.lang.ClassNotFoundException: b4j.example.starter$_dbcommand</pre></p>
<hr /><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.3.z-SNAPSHOT</a><hr/>
</body>
</html>
Error: java.lang.ClassNotFoundException: b4j.example.starter$_dbcommand
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Did you declared the custom type in the service too?

Add
B4X:
Type DBCommand (Name As String, Parameters() As Object)
to your servicecode in Process_Globals
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I tested your project.
You did not added the jobdone sub to your starter-code
B4X:
Sub JobDone(Job As HttpJob)
   If Job.Success = False Then
     Log("Error: " & Job.ErrorMessage)
   Else
     If Job.JobName = "DBRequest" Then
       Dim result As DBResult = reqManager.HandleJob(Job)
       If result.Tag = "cat 1" Then 'query tag
         For Each records() As Object In result.Rows
           Dim name As String = records(0) 'or records(result.Columns.Get("name"))
           Log(name)
         Next
       End If
     End If
   End If
   Job.Release
End Sub

Away from that it works... Ok, it ran into networkexception because there is no rdc server found....
 
Upvote 0

PSEAD

Member
Licensed User
Longtime User
Hi, I have the same problem trying to run it under starter. I have got the jobdone sub in the starter service, but I don't think that is the problem. It has something to do with the jrdc server. It finds a xxxxxxxx.main class and not a xxxxxxxx.starter class. This happens on the server before a response is sent back to the client. It bombs out on line 50 in the RDCHandler. Moving everything to the main activity sorts the problem out.

Update: If I create a "starter" code module on the server, and put the DBCommand declaration in it instead of "main" then it works. It looks like the DBCommand declaration in the server must match the client (in the same named code module)
 

Attachments

  • rdc.PNG
    rdc.PNG
    6.7 KB · Views: 165
  • rdc2.PNG
    rdc2.PNG
    7.9 KB · Views: 159
Last edited:
Upvote 0
Top