Hi,
I think it's final keyword
final ServiceReference ref =
ctx.getServiceReference(MarketStatusStreamService.class.getName());
which prevent to assign a new value to the ServiceReference ref.
Try remove the final, and don't use final for variable if you wanna
the variable changed during runtime.
Freeman
On 2012-5-16, at 下午7:19, maaruks wrote:
I have got service provider in one bundle and consumer in other.
If I reinstall (stop, uninstall, install and start) service provider
then
consumer can't get reference to the service anymore.
Here is service consumer code:
It keeps printing "ServiceReference is null" although provider has
registered a new service and it can get service reference.
ctx.getServiceReference(MarketStatusStreamService.class.getName() is
not
null.
Service provider code:
Am I doing something wrong ?
--
View this message in context:
http://karaf.922171.n3.nabble.com/service-reference-is-null-after-service-reinstall-tp3996874.html
Sent from the Karaf - User mailing list archive at Nabble.com.
---------------------------------------------
Freeman Fang
FuseSource
Email:[email protected]
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042