Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Dynamic Services Component verify bug?(Dynamic Services Component verify bug / error)
Dynamic Services Component verify bug? [message #553554] Wed, 18 August 2010 00:09 Go to next message
Brad is currently offline BradFriend
Messages: 5
Registered: July 2009
Junior Member
It has been quite the frustrating day. My code has been working perfectly fine and then the following...

I make heavy use of the Component xml files. I wired together my services using the component referenced services and cardinality. All was working well until something seemed to flip a switch and decide that my Implementation of an interface did not meet the correct method signature anymore. I cannot, for the life of me, see how this is possible considering the methods match exactly.

Here is the offending Component XML:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="Metric Manager">
   <implementation class="com.ngc.mc.metrics.MetricManagerImpl"/>
   <reference bind="setSensorManager" cardinality="1..1" interface="com.ngc.mc.sensor.ISensorManager" name="ISensorManager" policy="dynamic" unbind="unsetSensorManager"/>
   <reference bind="setSensorInformationProvider" cardinality="1..1" interface="com.ngc.mc.sensor.ISensorInformationProvider" name="ISensorInformationProvider" policy="dynamic" unbind="unsetSensorInformationProvider"/>
   <service>
      <provide interface="com.ngc.mc.metric.IMetricManager"/>
   </service>
</scr:component>



And here is the interface the component is attempting to adhere to:
public interface IMetricManager {

    public Request score(Request r);

    public void setSensorManager(ISensorManager sm);

    public void setSensorInformationProvider(ISensorInformationProvider sip);
}


And here is the implementation of the above interface, with a few lines of proprietary code removed:

public class MetricManagerImpl implements IMetricManager {
    ISensorManager             sensorManager      = null;
    ISensorInformationProvider sensorInfoProvider = null;

    @Override
    public Request score(Request r) {
      // code....
    }

    private int rawScore(Request r) {
        // Get location
        CompoundCoordinates<Altitude, LatLong> location = sensorManager
                .getSensorLocation();
        // TODO: finish scoring alg per use case 3.2
        return (int) Math.round((Math.random() * 100));
    }

    @Override
    public void setSensorManager(ISensorManager sm) {
        sensorManager = sm;
    }

    public void unsetSensorManager(ISensorManager sm) {
        if (sensorManager == sm) {
            sensorManager = null;
        }
    }

    @Override
    public void setSensorInformationProvider(ISensorInformationProvider sip) {
        sensorInfoProvider = sip;
    }

    public void unsetSensorInformationProvider(ISensorInformationProvider sip) {
        if (sensorInfoProvider == sip) {
            sensorInfoProvider = null;
        }
    }



}


The ERROR occurs on startup when OSGI attempts to create an instance of the MetricManagerImpl:
java.lang.VerifyError: (class: com/ngc/mc/metrics/MetricManagerImpl, method: score signature: (Lcom/ngc/mc/datamodel/Request;)Lcom/ngc/mc/datamodel/Request;) Incompatible argument to function
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
	at java.lang.Class.getConstructor0(Class.java:2699)
	at java.lang.Class.newInstance0(Class.java:326)
	at java.lang.Class.newInstance(Class.java:308)
	at org.eclipse.equinox.internal.ds.model.ServiceComponent.createInstance(ServiceComponent.java:457)
	at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.createInstance(ServiceComponentProp.java:254)
	at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:315)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:580)
	at org.eclipse.equinox.internal.ds.ServiceReg.getService(ServiceReg.java:53)
	at org.eclipse.osgi.internal.serviceregistry.ServiceUse$1.run(ServiceUse.java:120)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.internal.serviceregistry.ServiceUse.getService(ServiceUse.java:118)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:447)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:430)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService(BundleContextImpl.java:667)
	at org.osgi.util.tracker.ServiceTracker.addingService(ServiceTracker.java:442)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233)
	at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:840)
	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:933)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:756)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:711)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:206)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:507)
	at org.eclipse.equinox.internal.ds.InstanceProcess.registerService(InstanceProcess.java:496)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:259)
	at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:323)
	at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:221)
	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:933)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:756)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:711)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:206)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:507)
	at org.eclipse.equinox.internal.ds.InstanceProcess.registerService(InstanceProcess.java:496)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:259)
	at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:323)
	at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:221)
	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:933)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:756)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:711)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:206)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:507)
	at org.eclipse.equinox.internal.ds.InstanceProcess.registerService(InstanceProcess.java:496)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:259)
	at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:431)
	at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:213)
	at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:800)
	at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:767)
	at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
	at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70)


Any help would be greatly appreciated since I am holding up a team of people with this suddenly appearing error. I had not changed the method signature at all when this started happening. In addition, I cleaned, manually deleted class files, removed all run configurations, etc... so that the Equinox headless bundles would run fresh. Still I receive this problem.

Thanks,
Brad
Re: Dynamic Services Component verify bug? [message #553571 is a reply to message #553554] Wed, 18 August 2010 04:50 Go to previous message
BJ Hargrave is currently offline BJ HargraveFriend
Messages: 55
Registered: July 2009
Member
Does the export for package containing IMetricManager (com.ngc.mc.metrics) have a uses constraint on the package containing Result (com.ngc.mc.datamodel)?

If there are two exports for the com.ngc.mc.datamodel package, then the provider and the client for the service can be wired to different exports. Then the Result.class visible to the service provider may be different than the Result.class visible to the service client. Which will give errors.

All exports for the com.ngc.mc.metrics must declare uses on all packages used in the API including the com.ngc.mc.datamodel package.
Previous Topic:missing executable after headless product build
Next Topic:Deploy RAP application on Websphere
Goto Forum:
  


Current Time: Wed Nov 26 10:24:19 GMT 2014

Powered by FUDForum. Page generated in 0.02182 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software