Looking help for the issue - Caused by: java.lang.UnsatisfiedLinkError: com.couchbase.lite.internal.database.sqlite.SQLiteConnection.nativeOpen(Ljava/lang/String;ILjava/lang/String;ZZ)

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);
}
}

Does it work on other kinds of containers (like Ubuntu?). I don’t trust CentOS very much because the software it uses is all from the Jurassic Period.

Hi Team,
I am facing the same issue.
I have implemented CouchbaseLite in the spring boot application using the above mentioned dependencies in pom.xml. It’s working fine in local mac system.
But While running on GCP using docker container the application is failing . below is the error message

severity: “ERROR”
textPayload: "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) at com.lowes.associateassignment.repository.CouchbaseSingleton.(CouchbaseSingleton.java:42) at com.lowes.associateassignment.repository.CouchbaseSingleton.getInstance(CouchbaseSingleton.java:57) at

Please suggest on this.

I am facing the same issue. My springboot application is running fine in my local windows machine and able to replicate from couch base lite sync gateway. But getting this error when deployed to Azure cloud foundry(PCF) . I am thinking it is because of the relational DBPATH given. Please suggest a solution to the issue .

Hey @Sonali_Das . Are you using Couchbase Lite Java, v1.4.3? That’s what this question is about…