Mark-Anthony,

I believe what you are looking for is not getServiceReference as you already 
have the reference. I'm sure that what you need is getService() with passing in 
the reference.

- Joel



-----Original Message-----
From: Mark-Anthony Hutton [mailto:[email protected]] 
Sent: Monday, October 11, 2010 4:04 PM
To: [email protected]
Subject: Component Wrapping Problem

I appreciate any help I can get.

I have an instantiation of a class called SnapshotReader using the config file: 
com.navsys.tidgetsaasm.gatewaymanager.localsnapshotmanager.SnapshotReader-LocalStore.cfg

The class SnapshotReader @Provides the services TidgetSaasmDevice and Service.

In my GUI Class I @Require(optional=false) a TidgetSaasmDevice that is 
implemented by SnapshotReader. (I know this using the Felix WebConsole ).

When I try to cast the TidgetSaasmDevice(implemented by a SnapshotReader) into 
a SnapshotReader I get the exception(at Runtime):
        Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: 
com.navsys.tidgetsaasm.gatewaymanager.tidgetdevice.TidgetSaasmDevice$$Proxy 
cannot be cast to 
com.navsys.tidgetsaasm.gatewaymanager.localsnapshotmanager.SnapshotReader
At the line: SnapshotReader templocalstoretidget = (SnapshotReader) 
snapshotreadertidget;

Another Felix develeoper recommended I used 
bundleContext.getServiceReference(SnapshotReader.class.name()) to get the 
instantiation instead, since the Proxy is not doing it for me.
It returns null, but 
bundleContext.getServiceReference(TidgetSaasmDevice.class.getName()) works just 
fine.

I have confirmed for myself that a SnapshotReader instance does exist using the 
Felix WebConsole

Is there something I am missing or can do to get this instance as a 
SnapshotReader?

Thank you,

Mark-Anthony Hutton


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to