Software Defined Networking
1828779 Members
2676 Online
109985 Solutions
New Discussion

Re: binding error on my code (version 2.3.5)

 
sbotkine
Frequent Advisor

binding error on my code (version 2.3.5)

Hello, 

 

I have an error with the following binding code:

 

...

@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL_UNARY)
private volatile ControllerService controllerService;

@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL_UNARY)
private volatile DataPathListener dataPathListener;

 

protected void bindControllerService(ControllerService service) {
   controllerService = service;
   logger.info("DHCPSDN: Binding controller service BEFORE ERROR");
   controllerService.addDataPathListener(dataPathListener);
   logger.info("DHCPSDN: Binding controller service AFTER ERROR");
   controllerService.addPacketListener(this, PacketListenerRole.OBSERVER, 99999);
}

...

 

When I execute in on the controller, I obtained the following error:

 

[2014-09-15 11:05:58.240] INFO t Resolve Thread (Bundle 81) com.unil.dhcpsdn.impl.DhcpSdnManager DHCPSDN: Binding controller service BEFORE ERROR 
[2014-09-15 11:05:58.248] ERROR iLogServiceListener@761f3529 org.osgi.service.log.LogService 
Bundle com.unil.dhcpsdn.dhcpsdn-bl_1.0.0.SNAPSHOT, [SCR] Error while trying to bind reference Reference[name = controllerService, interface = com.hp.of.ctl.ControllerService, policy = dynamic, cardinality = 0..1, target = null, bind = bindControllerService, unbind = unbindControllerService]

As you can see on the error log, this is the instruction:    controllerService.addDataPathListener(dataPathListener);  that failed. 

 

Notice that the same code worked with the previous contoller version 2.0....

 

An idea ?

1 REPLY 1
sdnindia
Trusted Contributor

Re: binding error on my code (version 2.3.5)

Hello sbotkine,

 

Since the method  void addDataPathListener(DataPathListener listener) is same in version 2.0 and 2.3.5 so you might need to check if the dataPathListener (argument that is passed to the function) as well as the controllerService(object which is calling the function) have been properly initialized.

 

You can follow the SDN Programming guide page 222 to check how dataPathListener is initialized.

 

Please let us know if you still face any issue.

 

Thanks,

HP SDN Team