Have you seen this before?

17 views
Skip to first unread message

Geoffry Roberts

unread,
Oct 30, 2013, 4:20:25 PM10/30/13
to mong...@googlegroups.com
Brian,

Have you seen this before? This error usually shows up when there is a duplicate or otherwise misplaced jar file. I fail to see how that can be happening with eMongo.

I get the same error when exercising MongoClientProvider, as shown, but the same happens when doing something similar with the MongoDatabaseProvider.

java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) previously initiated loading for a different type with name "com/mongodb/MongoClient"

The code:

public void cli() {
log.info("cli ran");
MongoClientProvider provider = client.getClProvider();
log.info("provider=" + provider);
com.mongodb.MongoClient cli = provider.getMongoClient();
log.info("cli=" + cli);
List<String> dbs = cli.getDatabaseNames(); // This causes the error.
log.info("dbs=" + dbs);
log.info("db uri=" + database.getURI());
}

For good measure, here's the client configuration; which by all counts is now executing properly.

@Reference

void setConfigurationAdmin(ConfigurationAdmin configurationAdmin)

throws ConfigurationException {


log.info("setConfigurationAdmin configurationAdmin="

+ configurationAdmin);


try {

Configuration config = configurationAdmin.getConfiguration(

ConfigurationProperties.CLIENT_PID, null);


@SuppressWarnings("unchecked")

Dictionary<String, Object> properties = config.getProperties();


if (properties == null)

properties = new Hashtable<String, Object>();


properties.put(MongoClientProvider.PROP_CLIENT_ID, "storet");

properties.put(MongoClientProvider.PROP_URI, "mongodb://localhost");

config.update(properties);

} catch (IOException e) {

throw new ConfigurationException(e);

}

} 

Thanks

Bryan Hunt

unread,
Oct 30, 2013, 4:56:51 PM10/30/13
to mong...@googlegroups.com
Hi Geoffry,

I have seen LinkageError exceptions before, but never with MongoDB.  You might try the command "lb | grep mongo" and make sure you have only one version of the driver installed.  There should also be a way to inspect the wireing of the bundles.  Using the equinox condole, it's "b bundle#" and that will show you which import packages you are using and which bundle they are wired to.  From there, you can see which com.mongodb package your bundle is wired to vs the eMongo bundle.

Bryan

--
You received this message because you are subscribed to the Google Groups "MongoEMF" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoemf+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Geoffry Roberts

unread,
Oct 30, 2013, 7:17:07 PM10/30/13
to mong...@googlegroups.com
Brian,

I'll post this for your edification and whoever else's.

lb and there appears to be only one driver. 
lb -s and the extra driver shows up.  
Reply all
Reply to author
Forward
0 new messages