eMongo Showing Unsatisfied

87 views
Skip to first unread message

Geoffry Roberts

unread,
Oct 27, 2013, 8:23:16 PM10/27/13
to mong...@googlegroups.com
Brian,

I went back to work and now this:

emongo.api, emongo.components, and emongo.configuration all show as active, but when I check the components ~databaseProvider, ~clientProvider, and ~idFactory all show as unsatisfied.  The three metaType components are active.  Once again no errors are being thrown.  Yes, the driver bundle is active but not showing any components. Mongo itself is also running.

As I gather you run using equinox and I am using felix.  This is the felix that launches when one clicks run OSGi in the *.bndrun file dialog.   Can you tell me how you run this?  Will it be in your new user guide?

Hate to be a pest but there are a few things riding on this business.  It would be so great if I could get it to work.

Thanks

Bryan Hunt

unread,
Oct 27, 2013, 10:53:02 PM10/27/13
to mong...@googlegroups.com
Hi Geoffry,

You are most likely missing the configuration for the client and database services.  The emongo.configurator bundle provides an API for configuring the services, but does not do any sort of auto-configuration.  You can either use that API to do the configuration, use ConfigurationAdmin to do the configuration, or use the Web Console to do the configuration.

While the code has been developed using PDE, I have been using Bndtools to develop the code on top of these frameworks.  I have simply set up my .bndrun to use Equinox instead of Felix.  Either OSGi implementation will work just fine.  Getting everything wired up correctly can be challenging at first, but it does get easier.  If you are using the Equinox implementation of DS, you should be able to issue the "ls" command on the console to get a list of services that are unsatisfied.  Once you have that list, you should then be able to issue "comp #" where # is the service number shown from the ls command.  For example:

osgi> ls
All Components:
ID State Component Name Located in bundle
1 Unsatisfied net.springfieldusa.iph.app.signup.component.SignupComponent net.springfieldusa.iph.app.signup.component(bid=44)
2 Unsatisfied net.springfieldusa.iph.web.signup.SignupResource net.springfieldusa.iph.web.signup(bid=45)
3 Unsatisfied org.eclipselabs.emongo.clientProvider org.eclipselabs.emongo.components(bid=48)
4 Unsatisfied org.eclipselabs.emongo.databaseProvider org.eclipselabs.emongo.components(bid=48)
5 Unsatisfied org.eclipselabs.emongo.idFactory org.eclipselabs.emongo.components(bid=48)
6 Active org.eclipselabs.emongo.components.client.metatype org.eclipselabs.emongo.components(bid=48)
7 Active org.eclipselabs.emongo.components.database.metatype org.eclipselabs.emongo.components(bid=48)
8 Active org.eclipselabs.emongo.components.id.metatype org.eclipselabs.emongo.components(bid=48)

osgi> comp 3
Component[
name = org.eclipselabs.emongo.clientProvider
activate = activate
deactivate = deactivate
modified = 
configuration-policy = require
factory = null
autoenable = true
immediate = true
implementation = org.eclipselabs.emongo.components.MongoClientProviderComponent
state = Unsatisfied
properties = 
serviceFactory = false
serviceInterface = [org.eclipselabs.emongo.MongoClientProvider]
references = {
Reference[name = LogService, interface = org.osgi.service.log.LogService, policy = dynamic, cardinality = 0..1, target = null, bind = bindLogService, unbind = unbindLogService]
}
located in bundle = org.eclipselabs.emongo.components_1.0.0.201309151141 [48]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
  *The component has NO built configurations! The reason might be that it requires initialization by configuration provided by Configuration Admin but none was found

Looking at this debug output, the emongo.clientProvider is Unsatisifed.  Looking at the component details shows that it has NO built configurations.  This means the service properties are not available from ConfigurationAdmin.

I don't know if the Felix implementation of DS has similar commands available or not.  I hope this helps.

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.

Bryan Hunt

unread,
Oct 27, 2013, 11:01:11 PM10/27/13
to mong...@googlegroups.com
If you are using the Web Console, here are some screenshots showing configuration for localhost that may help ...

Client configuration:


Database configuration:



osgi> ls
All Components:
ID State Component Name Located in bundle
1 Active net.springfieldusa.iph.app.signup.component.SignupComponent net.springfieldusa.iph.app.signup.component(bid=44)
2 Active net.springfieldusa.iph.web.signup.SignupResource net.springfieldusa.iph.web.signup(bid=45)
3 Active org.eclipselabs.emongo.clientProvider org.eclipselabs.emongo.components(bid=48)
4 Active org.eclipselabs.emongo.databaseProvider org.eclipselabs.emongo.components(bid=48)
5 Unsatisfied org.eclipselabs.emongo.idFactory org.eclipselabs.emongo.components(bid=48)
6 Active org.eclipselabs.emongo.components.client.metatype org.eclipselabs.emongo.components(bid=48)
7 Active org.eclipselabs.emongo.components.database.metatype org.eclipselabs.emongo.components(bid=48)
8 Active org.eclipselabs.emongo.components.id.metatype org.eclipselabs.emongo.components(bid=48)


Bryan

Geoffry Roberts

unread,
Oct 28, 2013, 10:56:49 AM10/28/13
to mong...@googlegroups.com
Brian,

I am having a hard time seeing how I am having a configuration problem in light of your post.

I've included my command class in its entirety.  I call you attention to the first of the @Reference methods. Does it look right to you? (You should recognize it. It's a near cut and paste from one of your examples)  It executes without error when I run the command.  But if I un-comment either of the other two methods shown further below, The whole thing fails.  

btw
When running with equinox, I can't get a command prompt to appear.  Perhaps this is due to the lazy loading issue that was raised by someone last year ;-)


package iop.storet.cmd;


import java.io.IOException;

import java.util.Dictionary;

import java.util.Hashtable;


import org.apache.felix.service.command.CommandProcessor;

import org.eclipselabs.emongo.MongoClientProvider;

import org.eclipselabs.emongo.MongoDatabaseProvider;

import org.eclipselabs.emongo.config.ConfigurationProperties;

import org.eclipselabs.emongo.configurator.ConfigurationException;

import org.osgi.service.cm.Configuration;

import org.osgi.service.cm.ConfigurationAdmin;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;


import aQute.bnd.annotation.component.Activate;

import aQute.bnd.annotation.component.Component;

import aQute.bnd.annotation.component.Reference;


@Component(properties = { CommandProcessor.COMMAND_SCOPE + ":String=sr",

CommandProcessor.COMMAND_FUNCTION + ":String=cmd"}, provide = Object.class)

public class StoretCommand {


Logger log = LoggerFactory.getLogger(StoretCommand.class);


String clientId = "storet";

String clientURI = "storet";

@Activate

public void activate() {

log.info("activate ran");

}


public void cmd() {

log.info("cmd ran");

}


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

}


try {

Configuration config = configurationAdmin.getConfiguration(

ConfigurationProperties.DATABASE_PID, null);


@SuppressWarnings("unchecked")

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


if (properties == null)

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


properties.put(MongoDatabaseProvider.PROP_DATABASE, "storet");

properties.put(MongoDatabaseProvider.PROP_ALIAS, "storet");

config.update(properties);

} catch (IOException e) {

log.error("", e);

}

}


// If I un-comment either of these two groupings the bundle will not deploy properly and command will

// not work.

// MongoClientProvider clProvider;

//

// @Reference

// public void setClientProvider(MongoClientProvider clProvider) {

// log.info("clProvider=" + clProvider);

// this.clProvider = clProvider;

// }

// MongoDatabaseProvider dbProvider;

//

// @Reference

// public void setDatabaseProvider(MongoDatabaseProvider dbProvider) {

// log.info("dbProvider=" + dbProvider);

// this.dbProvider = dbProvider;

// }

Bryan Hunt

unread,
Oct 28, 2013, 11:15:14 AM10/28/13
to mong...@googlegroups.com
Hi Geoffry,

The reason it fails when you uncomment setClientProvider() and setDatabaseProvider() is because DS will not activate your service until after ALL the service references are all available.  This means that setConfigurationAdmin() will not get called until the MongoClientProvider and MongoDatabaseProvider services are available and those services will never be available because setConfigurationAdmin() is what is creating the configuration properties needed to activate those services.

You need to put the configuration into a separate component.

The Equinox console not appearing is a problem with lazy loading and can also be a problem associated with setting "osgi.console=".  If osg.console is set as the last property in your .bndrun, it doesn't work (there's a bug filed on that).  You have to have another property after it for it to work.  For the lazy loading problem, I simply include Neil's caffeine bundle.

Bryan


On Oct 28, 2013, at 09:56 AM, Geoffry Roberts <geoffry...@gmail.com> wrote:

Brian,

//this.dbProvider = dbProvider;

Geoffry Roberts

unread,
Oct 28, 2013, 11:45:01 AM10/28/13
to mong...@googlegroups.com
It's working now.  
Reply all
Reply to author
Forward
0 new messages