B4J Question jRDC2 Cannot serialize object

Bangdido

Member
Licensed User
Longtime User
Hello,

I'm having this error from jRDC2 demo

<title>Error 500 java.lang.RuntimeException: Cannot serialize object: 2018-04-06 00:00:00.0</title>

SQL Command
sql.usuarios_listado=SELECT * FROM usuarios ORDER BY usuario

MySQL Table Structure
CREATE TABLE IF NOT EXISTS `usuarios` (
`id` int(10) unsigned NOT NULL,
`usuario` varchar(15) NOT NULL,
`clave` varchar(32) NOT NULL,
`ultimoacceso` datetime NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

B4J
#AdditionalJar: mysql-connector-java-5.1.46-bin

is there a list of supported field types?
if i ran SELECT id,usuario,clave i get all records fine.
 

Bangdido

Member
Licensed User
Longtime User
B4J Server Output:
Emulated network latency: 100ms
jRDC is running (version = 2.1)
abr 09, 2018 12:25:35 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
INFORMACIÓN: 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 -> 2rvy8f9u1bkh43o15y7bh7|18ed237, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 2rvy8f9u1bkh43o15y7bh7|18ed237, idleConnectionTestPeriod -> 600, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost/mydbtest?characterEncoding=utf8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 1800, maxId...
4: 1
12: firstuser
12: e00e387585dd6c0fd8dbffcb4515ab24
93: 2018-04-06 00:00:00.0
(RuntimeException) java.lang.RuntimeException: Cannot serialize object: 2018-04-06 00:00:00.0
Comando: , tomo: 806ms, clientes=10.0.2.2

Field Structure
4: 1 (id field)
12: firstuser (usuario field)
12: e00e387585dd6c0fd8dbffcb4515ab24 (clave field)
93: 2018-04-06 00:00:00.0 (ultimoacceso field datetime)

For some reason i get a .0 at the end of the datetime field
93: 2018-04-08 01:45:03.0
93: 2018-04-01 09:55:32.0



Regards.
 
Last edited:
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Should line 79 in the RDCHanlder be
B4X:
row(i) = jrs.RunMethodJO(DateTimeMethods.Get(ct), Array(i + 1)).RunMethod("getTime", Null)
instead of
B4X:
row(i) = jrs.RunMethodJO(m.Get(ct), Array(i + 1)).RunMethod("getTime", Null)
 
Upvote 0

Bangdido

Member
Licensed User
Longtime User
Nope, not working.

Log(ct & ": " & row(i)) before next, line 83
4: 1 (id field)
12: isramos (usuario field)
12: e00e387585dd6c0fd8dbffcb4515ab24 (clave field)
(RuntimeException) java.lang.RuntimeException: Method: null not found in: com.mchange.v2.c3p0.impl.NewProxyResultSet
Command: , took: 639ms, client=10.0.2.2

the error ocurrs here line 79:
row(i) = jrs.RunMethodJO(m.Get(ct), Array(i + 1)).RunMethod("getTime", Null)
 
Last edited:
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

Bangdido

Member
Licensed User
Longtime User
Should line 79 in the RDCHanlder be
B4X:
row(i) = jrs.RunMethodJO(DateTimeMethods.Get(ct), Array(i + 1)).RunMethod("getTime", Null)
instead of
B4X:
row(i) = jrs.RunMethodJO(m.Get(ct), Array(i + 1)).RunMethod("getTime", Null)

Hello OliverA, thank you, but still not working. i have replace the line 78 for the one you said, and i get this error message:

4: 1
12: isramos
12: e00e387585dd6c0fd8dbffcb4515ab24
Ha ocurrido un error en la línea: 80
java.lang.RuntimeException: Method: getTimeStamp not found in: com.mchange.v2.c3p0.impl.NewProxyResultSet
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:366)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:119)
at anywheresoftware.b4j.object.JavaObject.RunMethodJO(JavaObject.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at


i get null object with this
ct = 98 (0x5D)
m.Get(ct) = null
 
Last edited:
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Change line 33 from
B4X:
    DateTimeMethods = CreateMap(91: "getDate", 92: "getTime", 93: "getTimeStamp")
to
B4X:
    DateTimeMethods = CreateMap(91: "getDate", 92: "getTime", 93: "getTimestamp")
 
Upvote 0

Bangdido

Member
Licensed User
Longtime User
Thank you Erel, OliverA, now is working Fine.
Line 13 Changed to
DateTimeMethods = CreateMap(91: "getDate", 92: "getTime", 93: "getTimestamp") ' In lowercase stamp

Line 79 Changed to
row(i) = jrs.RunMethodJO(DateTimeMethods.Get(ct), Array(i + 1)).RunMethod("getTime", Null)

Result:
4: 1
12: isramos
12: e00e387585dd6c0fd8dbffcb4515ab24
93: 1522990801000 <-- Timestamp value = '2018-04-06 00:00:01' in table
Command: query: usuarios_listado, took: 10536ms, client=10.0.2.2
 
Upvote 0
Top