Android Question JRDC2 error (***Command not found: null)

Serge Nova

Member
Hello everyone,
I'm trying to work with JRDC2 from Erel's example but so far without success.
When I run a request I receive this error: *** Command not found: null on the B4J side and yet I respected everything Erel said.

Here is my B4JPackager11 log :

B4JPackager11 Version 1.40
Exe name: B4JPackager11.exe
build folder: E:\PROGRA~1\B4A\New\JRDC2\B4JPAC~1\Objects\temp\build
InputJar: E:\Programmation\B4A\New\JRDC2\B4JPackager11\Objects\B4JPackager11.jar
Running: E:\PROGRA~1\B4A\New\JRDC2\B4JPAC~1\Objects\temp\FindDosPath.exe
Running: C:\jdk-11.0.1\bin\jar
.
Non-UI program
Package name: b4j.server
Running: C:\jdk-11.0.1\bin\jdeps
….
Explicitly excluded modules: [javafx.web]
Included modules: [jdk.charsets, jdk.crypto.ec, java.base, java.desktop, java.logging, javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, java.scripting, java.xml, jdk.unsupported, java.datatransfer, jdk.unsupported.desktop, jdk.jsobject, jdk.xml.dom]
Running: C:\jdk-11.0.1\bin\javac
Running: C:\jdk-11.0.1\bin\jar
Running: C:\jdk-11.0.1\bin\jlink
………………
Running: C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\csc.exe
Running: explorer.exe
Done!


And here is the error I get on the JRDC2 side:

Waiting for debugger to connect...
Program started.
2023-10-14 12:25:34.595:INFO :cmvl.MLog:MLog-Init-Reporter: MLog clients using slf4j logging.
2023-10-14 12:25:35.584:INFO :cmvc.C3P0Registry:main: Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
Port: 17178
2023-10-14 12:25:35.795:INFO :eek:ejs.Server:main: jetty-11.0.9; built: 2022-03-30T17:44:47.085Z; git: 243a48a658a183130a8c8de353178d154ca04f04; jvm 11.0.1+13
2023-10-14 12:25:35.965:INFO :eek:ejss.DefaultSessionIdManager:main: Session workerName=node0
2023-10-14 12:25:35.994:INFO :eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@7e4204e2{/,file:///E:/PROGRA~1/B4A/New/JRDC2/jRDC/Objects/www,AVAILABLE}
2023-10-14 12:25:36.045:INFO :eek:ejs.RequestLogWriter:main: Opened E:\Programmation\B4A\New\JRDC2\jRDC\Objects\logs\b4j-2023_10_14.request.log
2023-10-14 12:25:36.065:INFO :eek:ejs.AbstractConnector:main: Started ServerConnector@d554c5f{HTTP/1.1, (http/1.1)}{0.0.0.0:17178}
2023-10-14 12:25:36.075:INFO :eek:ejs.Server:main: Started Server@6f1c29b7{STARTING}[11.0.9,sto=0] @2291ms
Emulated network latency: 100ms
jRDC is running (version = 2.23)
method: query2
DebugQueries: true
2023-10-14 12:26:19.583:INFO :cmvci.AbstractPoolBackedDataSource:main: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 20000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1hgedvhazcoolqc5zgywj|4facf68f, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hgedvhazcoolqc5zgywj|4facf68f, idleConnectionTestPeriod -> 600, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost/tester?characterEncoding=utf8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 1800, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 150, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {password=******, user=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> true, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
commands Key: null
*** Command not found: null
(NullPointerException) java.lang.NullPointerException
Command: , took: 410ms, client=192.168.65.160
method: query2
DebugQueries: true
commands Key: null
*** Command not found: null
(NullPointerException) java.lang.NullPointerException

Command: , took: 2ms, client=192.168.65.160

And here is the error on side B4A Client:

Logger connecté à : Google Pixel 3

--------- beginning of main
ResponseError. Reason: Server Error, Response: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 java.lang.NullPointerException</title>
</head>
<body><h2>HTTP ERROR 500 java.lang.NullPointerException</h2>
<table>
<tr><th>URI:</th><td>/rdc</td></tr>
<tr><th>STATUS:</th><td>500</td></tr>
<tr><th>MESSAGE:</th><td>java.lang.NullPointerException</td></tr>
<tr><th>SERVLET:</th><td>anywheresoftware.b4j.object.JServlet-7f2cfe3f</td></tr>
</table>
<hr/><a href="https://eclipse.org/jetty">Powered by Jetty:// 11.0.9</a><hr/>
</body>
</html>

Job success: false

I got an error on the B4JPackager11 side which said: java.lang.IllegalStateException: No match found

I had to modify this to resolve the issue:

B4JPackager11:
Sub FindPackageName As ResumableSub
    Wait For (RunShell(False, "jar", Array("xf", "jar.jar", "META-INF"))) Complete (StdOut As String)
    Dim s As String = File.ReadString(TempFolder, "META-INF/MANIFEST.MF")
    Dim m As Matcher = Regex.Matcher2($"^JavaFX-Application-Class:\s+(.*)\.main$"$, Regex.MULTILINE, s)
    m.Find
'    PackageName = m.Group(1)
    PackageName = "b4j.example"
    Log($"Package name: ${PackageName}"$)
    Return True
End Sub

Is this the source of the problem?

When I running the test on the browser (http://localhost:17178/test) I get the message which indicates that everything is good:

RemoteServer is running (10/14/2023 18:51:53)
Connection successful.


I don't know exactly where the problem is that is preventing me from having access to the database, I need help dear member.
I attach the files below
 

Attachments

  • jRDC.rar
    111.3 KB · Views: 159
  • JRDC2 Client.rar
    265.7 KB · Views: 141
Solution
You must make the following changes in the jRDC2 client
Process_Globals:
    'Type DBCommand (name As String, Parameters() As Object) 'Bad name -> Name
    Type DBCommand (Name As String, Parameters() As Object) 'Good
And

CreateCommand:
'    cmd.Parameters = Parameter
    If Parameter <> Null Then cmd.Parameters = Parameter

Serge Nova

Member
I don't understand anything from this post. Sorry.

How is the packager related to the command not found error?
(Je pensais que l'erreur de commande introuvable s'était peut-être produite parce que j'avais modifié le code du packager B4JPackager11.
I just realized that B4JPackager11 is not useful in my example.
)



The problem I want to solve is command not found
 
Last edited:
Upvote 0

Serge Nova

Member
You don't need to use the Standalone Packager. For production, you just need to compile the server in Release mode.

jRDC2 is a server app (non-UI) so UI library such as javaFX is not required.
I referenced this post, just reread it and realize that B4JPackager11 is not important, thanks for the explanation.

The problem I'm having is, why am I getting this command not found error?
 
Upvote 0

Mariano Ismael Castro

Active Member
Licensed User
You must make the following changes in the jRDC2 client
Process_Globals:
    'Type DBCommand (name As String, Parameters() As Object) 'Bad name -> Name
    Type DBCommand (Name As String, Parameters() As Object) 'Good
And

CreateCommand:
'    cmd.Parameters = Parameter
    If Parameter <> Null Then cmd.Parameters = Parameter
 
Upvote 1
Solution
Top