Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Mongodb dependency returns class not found

Eman Cauchi May 30, 2018

I have a custom add-on with which I need to connect to a MongoDB instance to. I have put the following dependencies in my pom file: 

<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>bson</artifactId>
<version>3.7.0</version>
<scope>compile</scope>
</dependency>

I have also added the mongodb packages in the <Import-Package>

<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
org.bson.*;resolution:="optional",
com.mongodb.*;resolution:="optional", *
</Import-Package>

What am I doing wrong. Why does it still return the below error?

java.lang.NoClassDefFoundError: com/mongodb/MongoException

0 answers

Suggest an answer

Log in or Sign up to answer