B4J Question WebApp and JrdcUtil2 - general error

DarkoT

Active Member
Licensed User
Hi guys,
I will need a little help... I build new WebApplication based on ABMaterial framework... I already use RDC connector for get data from my&sql server for android applications and thats work fine... But - when I will call the same request over WebApp using Jrdcutil2, i will always geth a error:

ResponseError. Reason: java.lang.NullPointerException, Response: <html>
<title>Error 500 java.lang.NullPointerException</title>

What i doing wrong?

Routine:

Sub FillTable(StudentID As String) As ResumableSub

Dim Returnus As Int

jRDC2Utils.Intitialize("http://192.168.204.159:17178/rdc")
' jRDC2Utils.Intitialize("http://localhost:17178/rdc")


'Find all tests of this student with grade lower than 55.
Dim cmd As DBCommand = jRDC2Utils.CreateCommand("select_OFKupci", Null)
Wait For (jRDC2Utils.ExecuteQuery(cmd)) complete (res As DBResult)

If res <> Null Then
Returnus = 1
Else
Returnus = 0
End If
Return Returnus


End Sub

Tnx, Darko
 

OliverA

Expert
Licensed User
Longtime User
1) Wow! Someone is using jRDC2Utils!!!! 😊

Now some questions:
2) Which jRDC2 server are you using? Stock? Modified? If Modified, which one?
3) Are you sure select_OFKupci is in config.properties of the jRDC2 server?
4) What does the error log show on the jRDC2 server? Can you run the server in debug mode and see the full error message (trace stack and all)?

Note: Use code tags to post your code. You can also use the drop down list (the ...) next to the smiley face in the editor box to insert code tags (via the </> Code or >_ Inline code options). You can use the Quote option to post error messages.
 
Upvote 0

DarkoT

Active Member
Licensed User
1) Wow! Someone is using jRDC2Utils!!!! 😊
Why WoW? I think - this is really great utility and why not to use it?! In any case - big like for this ... ;) :p
2) Which jRDC2 server are you using? Stock? Modified? If Modified, which one?
I'm using "standard" solution of jRDC - downloaded from
jRDC2 - B4J implementation of RDC (Remote Database Connector)

and just little modified, that I can access sql server. And that works...

3) Are you sure select_OFKupci is in config.properties of the jRDC2 server?
Totaly sure... I builded one little android application (b4a) which has connection to RDC and can download the data...

4) What does the error log show on the jRDC2 server? Can you run the server in debug mode and see the full error message (trace stack and all)?
Here is ErrorLog from Debug of RDC - nothing special:

Waiting for debugger to connect...
Program started.
2020-04-10 16:41:33.683:INFO::main: Logging initialized @591ms to org.eclipse.jetty.util.log.StdErrLog
apr. 10, 2020 4:41:33 PM com.mchange.v2.log.MLog
INFO: MLog clients using java 1.4+ standard logging.
apr. 10, 2020 4:41:34 PM com.mchange.v2.c3p0.C3P0Registry
INFO: Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
2020-04-10 16:41:34.585:INFO:eek:ejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 1.8.0_241-b07
2020-04-10 16:41:34.634:INFO:eek:ejs.session:main: DefaultSessionIdManager workerName=node0
2020-04-10 16:41:34.634:INFO:eek:ejs.session:main: No SessionScavenger set, using defaults
2020-04-10 16:41:34.638:INFO:eek:ejs.session:main: node0 Scavenging every 600000ms
2020-04-10 16:41:34.642:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@3cb1ffe6{/,file:///C:/Work/Vtisk/B4JProjects/DatabaseConnector_SqlServer/Objects/www,AVAILABLE}
2020-04-10 16:41:34.647:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened C:\Work\Vtisk\B4JProjects\DatabaseConnector_SqlServer\Objects\logs\b4j-2020_04_10.request.log
2020-04-10 16:41:34.665:INFO:eek:ejs.AbstractConnector:main: Started ServerConnector@2f9829{HTTP/1.1,[http/1.1]}{0.0.0.0:17178}
2020-04-10 16:41:34.666:INFO:eek:ejs.Server:main: Started @1577ms
Emulated network latency: 100ms
jRDC is running (version = 2.28)
apr. 10, 2020 4:43:50 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
INFO: 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 -> 1hgeby9a9rw95p8vf8y8x|61443d8f, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> net.sourceforge.jtds.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hgeby9a9rw95p8vf8y8x|61443d8f, idleConnectionTestPeriod -> 600, initialPoolSize -> 3, jdbcUrl -> jdbc:jtds:sqlserver://192.168.204.159/utility, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 1800, maxIdleT...
(NullPointerException) java.lang.NullPointerException
Command: , took: 723ms, client=192.168.0.16"

Sounds like - system will not send real command to RDC server...

Please, if you can - take a look... If you need additional information, let me know... I really appreciate your help...

Thx, DArko
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
(NullPointerException) java.lang.NullPointerException
Command: , took: 723ms, client=192.168.0.16"
That means that it could not find the "select_OFKupci" in the config.properties file. Please note, with the default jRDC2 server (that you are using), the config.properties file should be located under the Files folder of the project source tree. Every time you modify the config.properties file, you need to re-compile the jRDC2 source. If compiled in release mode then re-deploy (re-start) the newly created .jar file.
Totaly sure... I builded one little android application (b4a) which has connection to RDC and can download the data...
Are you 100% sure the Android app and the ABMaterial web app are talking to the SAME server? It's just not possible that
B4X:
Dim cmd As DBCommand = jRDC2Utils.CreateCommand("select_OFKupci", Null)
Wait For (jRDC2Utils.ExecuteQuery(cmd)) complete (res As DBResult)
works properly in the Android app and not in the web app especially, since both are using
B4X:
jRDC2Utils.Intitialize("http://192.168.204.159:17178/rdc")
So
1) Either the apps are using different servers, or
2) If the are using the same server, this ->select_OFKupci<- is spelled differently in one of the apps
 
Upvote 0

DarkoT

Active Member
Licensed User
@OliverA - please - accept my apologys... I was expecting that jRDC for Android and for WebApp can be same (on server site)... Now I changed Jrdc for android to Jrdc2 to WebApp and work perfect...

Sory for my mistake...

Thank you for your help... I owe you a big caffee... :) :)

Regards, Darko
 
Upvote 0
Top