Syed Muhammad Asad
Syed Muhammad Asad

Reputation: 1

com/mongodb/MongoException in Siddhi app mongo-store extension

I'm working in WSO2-SI (streaming integrator) and building some siddhi apps. I came to need to use a mongodb-store extension which is available in siddhi store. I installed the extensions and configure the @store with type mongodb. But It seems that, I can't run the app because I'm facing an error com/mongodb/MongoException. Sometime, when I restart the SI, I see com/mongodb/MongoSocketOpenException. I don't why it's happening and how to debug this error. I can see that mongodb jar files in under {WSO2-SI-HOME}/lib/ directory, so extension is installed but not properly working.

Here is the full code of my siddhi app:

@App:name("MongoDB search")
@App:description("desc is here")

define stream SearchID (id string)

-- Exceptions appears here: com/mongodb/MongoException or com/mongodb/MongoSocketOpenException 
@store(type="mongodb", mongodb.uri="mongodb://user:[email protected]:27017/database_name?replicaSet=rs0", collection.name="users")
define table UsersTable (id string, date_of_birth string, gender string, height_cm double, weight_kg double);

@sink(type='log', prefix='Logging') 
define stream ListeningLogs(id string, Date_of_Birth string, Gender string, Height double, Original_Weight double)

@info(name='logging')
from SearchID as s join UsersTable as u
    on s.id == u.id
select u.id, u.date_of_birth as Date_of_Birth, u.gender as Gender, u.height_cm as Height, u.weight_kg as Original_Weight
insert into ListeningLogs;


New Lines Added

I tested the app on server and found the following cause:

Caused by: java.lang.NoClassDefFoundError: com/mongodb/MongoSocketOpenException
...
Caused by: java.lang.ClassNotFoundException: com.mongodb.MongoSocketOpenException cannot be found by siddhi-store-mongodb_2.1.1

But I don't know, how to fix it.

Upvotes: 0

Views: 157

Answers (1)

chenbiao
chenbiao

Reputation: 46

You need to add mongo-java-driver-3.4.2.jar to {Home}/lib/

Upvotes: 0

Related Questions