cloudant / sync-android

A JSON-based document datastore for Android applications
Apache License 2.0
267 stars 91 forks source link

Offline Document Store creation not working by running distributable Jar. #570

Closed ZaheerUdDeen closed 6 years ago

ZaheerUdDeen commented 6 years ago

I am using this library for JavaFX desktop application.

The Same issue exists after creating ant built the distributable .exe package for deploying on different window systems.

tomblench commented 6 years ago

I suggest you add logging (see https://github.com/cloudant/sync-android/blob/master/doc/logging.md) to your deployed application and examine the logs to see what is going wrong.

Or you could modify your deployed program so that it generates extra output (to the console or a file) which will help us pinpoint exactly what is going wrong.

Your issue may be a problem with our library, or it may be a bug in your code, or a problem with the environment or configuration of your application. At the moment, and without extra information, we can't tell which it is.

ZaheerUdDeen commented 6 years ago

HI, I got some findings. Hope these will help.

  1. Below is the log Console output when i run my application from Netbeans and everything working perfectly.

netbeanseconsole netbeanseconsole1

  1. Now This is the output when I run the application by executing Application.jar file through windows command prompt. consoleaferrunningjar In the second case after the redline, nothing is appearing.

Now the underlined bluelines of both output are same but the difference comes after the red line.

tomblench commented 6 years ago

We don't have any experience of running on Windows but apart from the [SEVERE] null and instantiated [null] log messages, everything else looks fine.

In your first example it looks like 6 documents were pushed to your remote server, did you check on the remote side to see that those documents had been pushed?

ZaheerUdDeen commented 6 years ago

Yes in the first case(when I run the application through IDE i.e Netbeans or eclipse) everything working fine.

but when i create .jar file and deployable package it creates problem.

tomblench commented 6 years ago

I suspect your deployed jar is having trouble locating the native DLL for sqlite4java

ZaheerUdDeen commented 6 years ago

Let me tell the whole story.

I am using java-cloudant to create the database only for the first time when a user creates an account.

Then i am using sync-android to use this database with offline first approach.

Now when I run my application form IDE everything working perfectly both java-cloudant and sync-android.

after creating .jar file the database is created perfectly which is done through java-cloudant, but applicaiton is not creating offline store which is done by sync-android library.

This is the exact line which is not working. DocumentStore ds = DocumentStore.getInstance(new File(path, "my_document_store"));

Did this library is checked after creating and ruining jar files?

ZaheerUdDeen commented 6 years ago

yes, I suspect that too, Let me do homework to find some solution.

ZaheerUdDeen commented 6 years ago

Exactly that was the issue. when I manually copy native DLL for sqlite4java in library folder where sqlite4java.jar exists everything works fine. thanks.