View Issue Details

IDProjectCategoryView StatusLast Update
0003377SymmetricDSBugpublic2018-10-12 19:00
Reporterlmgaborit Assigned Tomaxwellpettit  
Priorityurgent 
Status resolvedResolutionfixed 
Product Version3.9.2 
Target Version3.9.15Fixed in Version3.9.15 
Summary0003377: Android SQLite Register NullPointerException
DescriptionHi,

When I want to register a node with SymmetricDS 3.9.2, I have this stacktrace in Logcat and this message : "Could not register".

It's the same issue with SymmetricDS 3.9.1 but it works with SymmetricDS 3.9.0.

Thanks,
Additional Information01-17 16:05:00.532 7542-7618/fr.eclasel.adp.mobile E/o*.j*.s*.s*.i*.ManageI*: An error caused a batch to fail without attempting to load data for batch 000--9999
                                                                              java.lang.NullPointerException: Attempt to invoke interface method 'org.jumpmind.db.sql.ISqlTemplate org.jumpmind.db.platform.IDatabasePlatform.getSqlTemplate()' on a null object reference
                                                                                  at org.jumpmind.symmetric.io.data.writer.DynamicDefaultDatabaseWriter.open(DynamicDefaultDatabaseWriter.java:113)
                                                                                  at org.jumpmind.symmetric.io.data.writer.NestedDataWriter.open(NestedDataWriter.java:44)
                                                                                  at org.jumpmind.symmetric.model.ProcessInfoDataWriter.open(ProcessInfoDataWriter.java:47)
                                                                                  at org.jumpmind.symmetric.io.data.writer.NestedDataWriter.open(NestedDataWriter.java:44)
                                                                                  at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:104)
                                                                                  at org.jumpmind.symmetric.service.impl.DataLoaderService.loadDataFromTransport(DataLoaderService.java:605)
                                                                                  at org.jumpmind.symmetric.service.impl.DataLoaderService.loadDataFromPull(DataLoaderService.java:296)
                                                                                  at org.jumpmind.symmetric.service.impl.DataLoaderService.loadDataFromPull(DataLoaderService.java:253)
                                                                                  at org.jumpmind.symmetric.service.impl.RegistrationService.attemptToRegisterWithServer(RegistrationService.java:467)
                                                                                  at org.jumpmind.symmetric.service.impl.RegistrationService.registerWithServer(RegistrationService.java:443)
                                                                                  at org.jumpmind.symmetric.service.impl.PullService.pullData(PullService.java:89)
                                                                                  at org.jumpmind.symmetric.AbstractSymmetricEngine.pull(AbstractSymmetricEngine.java:901)
                                                                                  at org.jumpmind.symmetric.android.AndroidJobManager$Job.invoke(AndroidJobManager.java:176)
                                                                                  at org.jumpmind.symmetric.android.AndroidJobManager$Job.run(AndroidJobManager.java:127)
                                                                                  at java.util.Timer$TimerImpl.run(Timer.java:284)
01-17 16:05:00.535 7542-7618/fr.eclasel.adp.mobile E/o*.j*.s*.s*.i*.ManageI*: Failed to load batch 000--9999
                                                                              java.lang.NullPointerException: Attempt to invoke interface method 'org.jumpmind.db.sql.ISqlTemplate org.jumpmind.db.platform.IDatabasePlatform.getSqlTemplate()' on a null object reference
                                                                                  at org.jumpmind.symmetric.io.data.writer.DynamicDefaultDatabaseWriter.open(DynamicDefaultDatabaseWriter.java:113)
                                                                                  at org.jumpmind.symmetric.io.data.writer.NestedDataWriter.open(NestedDataWriter.java:44)
                                                                                  at org.jumpmind.symmetric.model.ProcessInfoDataWriter.open(ProcessInfoDataWriter.java:47)
                                                                                  at org.jumpmind.symmetric.io.data.writer.NestedDataWriter.open(NestedDataWriter.java:44)
                                                                                  at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:104)
                                                                                  at org.jumpmind.symmetric.service.impl.DataLoaderService.loadDataFromTransport(DataLoaderService.java:605)
                                                                                  at org.jumpmind.symmetric.service.impl.DataLoaderService.loadDataFromPull(DataLoaderService.java:296)
                                                                                  at org.jumpmind.symmetric.service.impl.DataLoaderService.loadDataFromPull(DataLoaderService.java:253)
                                                                                  at org.jumpmind.symmetric.service.impl.RegistrationService.attemptToRegisterWithServer(RegistrationService.java:467)
                                                                                  at org.jumpmind.symmetric.service.impl.RegistrationService.registerWithServer(RegistrationService.java:443)
                                                                                  at org.jumpmind.symmetric.service.impl.PullService.pullData(PullService.java:89)
                                                                                  at org.jumpmind.symmetric.AbstractSymmetricEngine.pull(AbstractSymmetricEngine.java:901)
                                                                                  at org.jumpmind.symmetric.android.AndroidJobManager$Job.invoke(AndroidJobManager.java:176)
                                                                                  at org.jumpmind.symmetric.android.AndroidJobManager$Job.run(AndroidJobManager.java:127)
                                                                                  at java.util.Timer$TimerImpl.run(Timer.java:284)
01-17 16:05:00.552 7542-7618/fr.eclasel.adp.mobile E/o*.j*.s*.s*.i*.DataLoa*: Failed to process batch
                                                                              java.lang.NullPointerException: Attempt to invoke virtual method 'long org.jumpmind.util.Statistics.stopTimer(java.lang.String)' on a null object reference
                                                                                  at org.jumpmind.symmetric.io.data.writer.DefaultDatabaseWriter.rollback(DefaultDatabaseWriter.java:178)
                                                                                  at org.jumpmind.symmetric.io.data.writer.DynamicDefaultDatabaseWriter.rollback(DynamicDefaultDatabaseWriter.java:146)
                                                                                  at org.jumpmind.symmetric.io.data.writer.AbstractDatabaseWriter.end(AbstractDatabaseWriter.java:511)
                                                                                  at org.jumpmind.symmetric.io.data.writer.DefaultDatabaseWriter.end(DefaultDatabaseWriter.java:140)
                                                                                  at org.jumpmind.symmetric.io.data.writer.NestedDataWriter.end(NestedDataWriter.java:72)
                                                                                  at org.jumpmind.symmetric.model.ProcessInfoDataWriter.end(ProcessInfoDataWriter.java:77)
                                                                                  at org.jumpmind.symmetric.io.data.writer.NestedDataWriter.end(NestedDataWriter.java:72)
                                                                                  at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:140)
                                                                                  at org.jumpmind.symmetric.service.impl.DataLoaderService.loadDataFromTransport(DataLoaderService.java:605)
                                                                                  at org.jumpmind.symmetric.service.impl.DataLoaderService.loadDataFromPull(DataLoaderService.java:296)
                                                                                  at org.jumpmind.symmetric.service.impl.DataLoaderService.loadDataFromPull(DataLoaderService.java:253)
                                                                                  at org.jumpmind.symmetric.service.impl.RegistrationService.attemptToRegisterWithServer(RegistrationService.java:467)
                                                                                  at org.jumpmind.symmetric.service.impl.RegistrationService.registerWithServer(RegistrationService.java:443)
                                                                                  at org.jumpmind.symmetric.service.impl.PullService.pullData(PullService.java:89)
                                                                                  at org.jumpmind.symmetric.AbstractSymmetricEngine.pull(AbstractSymmetricEngine.java:901)
                                                                                  at org.jumpmind.symmetric.android.AndroidJobManager$Job.invoke(AndroidJobManager.java:176)
                                                                                  at org.jumpmind.symmetric.android.AndroidJobManager$Job.run(AndroidJobManager.java:127)
                                                                                  at java.util.Timer$TimerImpl.run(Timer.java:284)
TagsNo tags attached.

Activities

hanes

2018-10-03 17:21

developer   ~0001253

Can you try this in 3.9.13 and let us know if it's still an issue?

pilber

2018-10-05 18:51

reporter   ~0001257

3.9.13 and 3.9.14 showing pretty the same output on Logcat, log pasted below.

I arrived there fresh installing 3.9.13 on Windows 10 and following succesfully the demo https://www.symmetricds.org/doc/3.9/html/tutorials.html

And after that following the chapter 7.2 Embedding in android from users guide
https://www.symmetricds.org/doc/3.9/html/user-guide.html#_embedding_in_android
which didn't worked as-is and had to find workarounds: (*You may consider extending the tutorial with a Quick start Demo With Android)
-first copying the libs folder with a bit of uncertainity of the best practice to do it and Android Studio didn't recognized it at first, also at the end of test trying to make it work with 3.9.13, when changing to 3.9.14 jars has to delete the build folder to erase older references.
-second was the reference not found of import org.apache.commons.lang.StringUtils; in MainActivity.java, so I inserted on build.gradle (Module: app): implementation 'commons-lang:commons-lang:2.6' (following this https://stackoverflow.com/questions/32835143/how-to-add-org-apache-commons-lang3-to-androidstudio-with-gradle )
-third was being unsure if the node should be a new-node relating to the three nodes preconfigured in the demo (corp-000 store-001 store-002) or should point to one of the two stores (like if the server was going to keep a database specific for that android device sinchronized 1-1 with it) - this point should look trivial to most existing Symmetricds users but it is not to new users. So several combinations.
-fourth, appeared in logcat the confilicting parameters thing (yes confilicting) that here says it was corrected https://www.symmetricds.org/issues/view.php?id=3626 (but it wasn't or at least a regression occurs in 3.9.13), so had to add
properties.put("stream.to.file.enabled", "true");
-fifth, the problem of this issue, also posted here (also with the fourth one):
https://sourceforge.net/p/symmetricds/discussion/1354726/thread/1925d716/
I couldn't workaround this one, so I'm stuck here. I hope these informations helps you to find the problem.
I also looked at the sources but couldn't find very much.
The code that produces the exception is symmetricDialect.getTargetPlatform().getClass() with targetPlatform being null apparently.
I see targetPlatform implemented in 3.9 https://github.com/JumpMind/symmetric-ds/blob/3.9/symmetric-core/src/main/java/org/jumpmind/symmetric/db/AbstractSymmetricDialect.java
Only reference found on Github to setTargetPlatform is in:
https://github.com/JumpMind/symmetric-ds/blob/3.9/symmetric-client/src/main/java/org/jumpmind/symmetric/ClientSymmetricEngine.java
ClientSymmetricEngine extends AbstractSymmetricEngine as AndroidSymmetricEngine do, but this last don't appear to call setTargetPlatform
https://github.com/JumpMind/symmetric-ds/blob/3.9/symmetric-android/src/main/java/org/jumpmind/symmetric/android/AndroidSymmetricEngine.java

Thanks for your efforts.
---------------------------------------------------------
10-05 13:53:36.001 1633-1666/org.jumpmind.symmetric.symmetricandroidclientdemo I/o*.j*.s*.s*.i*.Registr*: Could not register. Sleeping for 26000ms before attempting again.
10-05 13:54:02.003 1633-1666/org.jumpmind.symmetric.symmetricandroidclientdemo I/o*.j*.s*.s*.i*.Registr*: This node is unregistered. It will attempt to register using the registration.url
10-05 13:54:02.012 1633-1666/org.jumpmind.symmetric.symmetricandroidclientdemo I/o*.j*.s*.s*.i*.DataLoa*: Using registration URL of http://192.168.5.99:31415/sync/corp-000/registration?nodeGroupId=store&externalId=004&syncURL=http%3A%2F%2Flocalhost%3A31415%2Fsync%2Fcorp-000&schemaVersion=%3F&databaseType=sqlite&databaseVersion=2.0&symmetricVersion=development&deploymentType=android&hostName=localhost&ipAddress=10.0.2.15
10-05 13:54:02.122 1633-1799/org.jumpmind.symmetric.symmetricandroidclientdemo W/o*.j*.s*.s*.StatisticM*: Starting a new process even though the previous 'Database Pull Load' process had not finished
10-05 13:54:02.123 1633-1799/org.jumpmind.symmetric.symmetricandroidclientdemo I/o*.j*.s*.s*.StatisticM*: Details from the previous process: processType=Database Pull Load,sourceNodeId=null,targetNodeId=null,queue=,status=Loading,startTime=Fri Oct 05 13:53:35 EDT 2018
10-05 13:54:02.128 1633-1799/org.jumpmind.symmetric.symmetricandroidclientdemo E/o*.j*.s*.s*.i*.ManageI*: An error caused a batch to fail without attempting to load data for batch 000--9999
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
        at org.jumpmind.symmetric.load.DefaultDataLoaderFactory.getDataWriter(DefaultDataLoaderFactory.java:72)
        at org.jumpmind.symmetric.service.impl.DataLoaderService.buildDataWriter(DataLoaderService.java:721)
        at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2$1.chooseDataWriter(DataLoaderService.java:1036)
        at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:101)
        at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2.call(DataLoaderService.java:1039)
        at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2.call(DataLoaderService.java:1016)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
    Failed to load batch 000--9999
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
        at org.jumpmind.symmetric.load.DefaultDataLoaderFactory.getDataWriter(DefaultDataLoaderFactory.java:72)
        at org.jumpmind.symmetric.service.impl.DataLoaderService.buildDataWriter(DataLoaderService.java:721)
        at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2$1.chooseDataWriter(DataLoaderService.java:1036)
        at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:101)
        at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2.call(DataLoaderService.java:1039)
        at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2.call(DataLoaderService.java:1016)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
10-05 13:54:02.130 1633-1666/org.jumpmind.symmetric.symmetricandroidclientdemo E/o*.j*.s*.s*.i*.DataLoa*: Failed to process batch
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
        at org.jumpmind.symmetric.load.DefaultDataLoaderFactory.getDataWriter(DefaultDataLoaderFactory.java:72)
        at org.jumpmind.symmetric.service.impl.DataLoaderService.buildDataWriter(DataLoaderService.java:721)
        at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2$1.chooseDataWriter(DataLoaderService.java:1036)
        at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:101)
        at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2.call(DataLoaderService.java:1039)
        at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2.call(DataLoaderService.java:1016)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
10-05 13:54:02.135 1633-1666/org.jumpmind.symmetric.symmetricandroidclientdemo I/o*.j*.s*.s*.i*.Registr*: Could not register. Sleeping for 29000ms before attempting again.
10-05 13:54:31.137 1633-1666/org.jumpmind.symmetric.symmetricandroidclientdemo I/o*.j*.s*.s*.i*.Registr*: This node is unregistered. It will attempt to register using the registration.url
10-05 13:54:31.145 1633-1666/org.jumpmind.symmetric.symmetricandroidclientdemo I/o*.j*.s*.s*.i*.DataLoa*: Using registration URL of http://192.168.5.99:31415/sync/corp-000/registration?nodeGroupId=store&externalId=004&syncURL=http%3A%2F%2Flocalhost%3A31415%2Fsync%2Fcorp-000&schemaVersion=%3F&databaseType=sqlite&databaseVersion=2.0&symmetricVersion=development&deploymentType=android&hostName=localhost&ipAddress=10.0.2.15
...

hanes

2018-10-10 18:42

developer   ~0001268

What version of Java are you using?

pilber

2018-10-10 21:06

reporter   ~0001269

Here:
E:\symmetric-server-3.9.13>java -version
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

maxwellpettit

2018-10-12 18:52

manager   ~0001273

Last edited: 2018-10-12 18:53

View 2 revisions

I have committed changes for the workarounds mentioned in the demo: https://github.com/JumpMind/symmetric-android-client-demo/commit/48e94a6f6ad8f5fab048320272ac0fd6a6d08e3e

However, these workarounds do not resolve the null pointer exception.

These issues (including the null pointer) will all be fixed with the 3.9.15 release. You can also clone the latest symmetric-ds GitHub repository and generate the android libraries directory manually. To do this, clone the symmetric-ds repository and run the command:

symmetric-ds/symmetric-assemble/gradlew androidDistZip

This will generate the libraries in an archive in symmetric-ds/symmetric-android/build/distributions

Related Changesets

SymmetricDS: 3.9 2df19e58

2018-10-12 14:45:27

maxwellpettit

Details Diff
0003377: Android SQLite Register NullPointerException Affected Issues
0003377
mod - symmetric-android/src/main/java/org/jumpmind/symmetric/android/AndroidSymmetricEngine.java Diff File
mod - symmetric-android/src/main/java/org/jumpmind/symmetric/android/AndroidTypedPropertiesFactory.java Diff File
mod - symmetric-assemble/common.gradle Diff File

Issue History

Date Modified Username Field Change
2018-01-17 15:07 lmgaborit New Issue
2018-10-03 17:21 hanes Status new => feedback
2018-10-03 17:21 hanes Note Added: 0001253
2018-10-05 18:51 pilber Note Added: 0001257
2018-10-10 18:42 hanes Note Added: 0001268
2018-10-10 21:06 pilber Note Added: 0001269
2018-10-12 18:45 maxwellpettit Assigned To => maxwellpettit
2018-10-12 18:45 maxwellpettit Status feedback => assigned
2018-10-12 18:52 maxwellpettit Status assigned => resolved
2018-10-12 18:52 maxwellpettit Resolution open => fixed
2018-10-12 18:52 maxwellpettit Fixed in Version => 3.9.15
2018-10-12 18:52 maxwellpettit Note Added: 0001273
2018-10-12 18:53 maxwellpettit Note Edited: 0001273 View Revisions
2018-10-12 19:00 maxwellpettit Changeset attached => SymmetricDS 3.9 2df19e58