Software Defined Networking
1753773 Members
5153 Online
108799 Solutions
New Discussion

Cannot get service from controller.

 
youngnr
Occasional Contributor

Cannot get service from controller.

I'm a new developer trying to develop a sdn controller app.

After reading the programmer, i tried to program a demo app to test the Database and ofm module.

So i code like this :

 

@Component

public class Test{

@Reference(name = "ControllerService", policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MANDATORY_UNARY)
private volatile ControllerService ctrlService;

...

public void bind(ControllerService service) {....}

public void unbindControllerService(ControllerService service) {....}

}

 

And then, the embrassing bug came.

---------------------------------------------------------------------------------

Connection Error in Persistence layercom.netflix.astyanax.connectionpool.exceptions.NoAvailableHostsException: NoAvailableHostsException: [host=None(0.0.0.0):0, latency=0(0), attempts=0]No hosts to borrow from

---------------------------------------------------------------------------------

ps. when i tried to get the service like DataStoreService<DataStoreContext>,which should be implements in the cassandra module, i get the same bug.

Is there anyone could help me  ? I'm dying debuging this with no clue.It's even better if someone could offer me soem demo code. 

Thank you !

2 REPLIES 2
ScottReeve
Advisor

Re: Cannot get service from controller.

I don't think you want to call bind and unbind.  This is what you put in the post:

 

@Component

public class Test{

@Reference(name = "ControllerService", policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MANDATORY_UNARY)
private volatile ControllerService ctrlService;

 

public void bind(ControllerService service) {....}

public void unbindControllerService(ControllerService service) {....}

 

It appears you should be writing your own bind method.  Please see this example:

 

 

@Reference(name = "ControllerService",
                         cardinality = ReferenceCardinality.OPTIONAL_UNARY,
                         policy = ReferencePolicy.DYNAMIC)
                         private ControllerService cs;

 

 /** Bind hook for the controller service. */
protected void bindControllerService(ControllerService cs) {

 

...

 

}

 

 

Regards,

 

Scott

 

sdnindia
Trusted Contributor

Re: Cannot get service from controller.

Hello youngnr,

Doing a follow up to check if you tried as suggested in erliar post.
Please do let us know  if your problem is solved.

If you have more questions on the same topic please do reply on the same thread or open a new post if new topic.


Thanks
HP SDN Team