Hi Team,
I’m looking for help on working couchbase lite, integrating with spring boot application.
I’ve integrated couchbase lite in the application by using below dependencies in pom.xml . The same application is running fine and syncing all the data to coucbase lite from couchbase server using syncgateway in local mac system.
But while running using docker container (With linux centOS) the application is failing with below exception stack trace.
I would be grateful for your suggestions.
pom.xml :
<dependency>
<groupId>com.couchbase.lite</groupId>
<artifactId>couchbase-lite-java-sqlcipher</artifactId>
<version>1.4.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.couchbase.lite/couchbase-lite-java-core -->
<dependency>
<groupId>com.couchbase.lite</groupId>
<artifactId>couchbase-lite-java-core</artifactId>
<version>1.4.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.couchbase.lite/couchbase-lite-java -->
<dependency>
<groupId>com.couchbase.lite</groupId>
<artifactId>couchbase-lite-java</artifactId>
<version>1.4.3</version>
</dependency>
Exceptions Stack trace :
2019-07-09 20:08:44.274 ERROR [{}] 6 — [ main] c.c.lite : Database: Cannot load native library
Exception in thread “main” java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.UnsatisfiedLinkError: com.couchbase.lite.internal.database.sqlite.SQLiteConnection.nativeOpen(Ljava/lang/String;ILjava/lang/String;ZZ)J
at com.couchbase.lite.internal.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at com.couchbase.lite.internal.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:194)
at com.couchbase.lite.internal.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:178)
at com.couchbase.lite.internal.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:461)
at com.couchbase.lite.internal.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:191)
at com.couchbase.lite.internal.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:183)
at com.couchbase.lite.internal.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:820)
at com.couchbase.lite.internal.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:803)
at com.couchbase.lite.internal.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:698)
at com.couchbase.lite.storage.SQLiteStorageEngineBase.open(SQLiteStorageEngineBase.java:70)
at com.couchbase.lite.store.SQLiteStore.open(SQLiteStore.java:186)
at com.couchbase.lite.Database.open(Database.java:1333)
at com.couchbase.lite.Manager.openDatabase(Manager.java:341)
at com.couchbase.lite.Manager.getDatabase(Manager.java:305)
Below code used to get the Couchbase Lite instance to work with :
private CouchbaseLiteDriver(String contextSubDir, String dbNameToOpen) {
try {
this.manager = new Manager(new JavaContext(contextSubDir), Manager.DEFAULT_OPTIONS);
this.database = this.manager.getDatabase(dbNameToOpen);
} catch (Exception e) {
log.error(“Exception occured while setting up couchbase singleton connection object”,
e);
}
}