Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse Communications Framework (ECF) » Exception using RemoteServices(Exception generated when connecting container)
Exception using RemoteServices [message #1044228] Thu, 18 April 2013 16:38 Go to next message
Robert Onslow is currently offline Robert OnslowFriend
Messages: 13
Registered: April 2010
Junior Member
I am using a container for both remote services and distributed event admin:

final IRemoteServiceContainerAdapter rsc = (IRemoteServiceContainerAdapter) ((IAdaptable) container).getAdapter(IRemoteServiceContainerAdapter.class);
rsc.addRemoteServiceListener(new IRemoteServiceListener() {

 @Override
  public void handleServiceEvent(IRemoteServiceEvent event) {
		String targetClass = StateProvider.class.getName();
		String[] clazzes = event.getClazzes();
		boolean quit = false;
		for (int i = 0; !quit && i < clazzes.length; i++)
			quit = clazzes[i].equals(targetClass);
		if (quit) try {
		  IRemoteServiceReference ref = event.getReference();
				
		  IRemoteService rs = rsc.getRemoteService(ref);
		  IRemoteCall call = new RemoteCall("provideState");
		  Map<String, Object> state = (Map<String, Object>) rs.callSync(call);
		  syncBundles(state);
		} catch (Exception x) {Log.log(Log.ERROR, x.getMessage());
				disconnect();}
		}
			
		});
		final ISharedObjectContainer soc = (ISharedObjectContainer) ((IAdaptable) container).getAdapter(ISharedObjectContainer.class);
		
		soc.addListener(new IContainerListener() {

			@Override
			public void handleEvent(IContainerEvent event) {
				if (event instanceof IContainerConnectedEvent)
				try {
						
				ISharedObjectManager manager = soc.getSharedObjectManager();
				admin = new DistributedEventAdmin(context);
				ID id1 = IDFactory.getDefault().createStringID("uk.co.xlegal.xbundle3.remote");
				Properties props = new Properties();
				props.put(EventConstants.EVENT_TOPIC, "uk_co_xlegal_xbundle3_remote");

				manager.addSharedObject(id1, (ISharedObject) admin, props);
				((DistributedEventAdmin) admin).start();
						
						
						
			} catch (Exception e) {
						Log.log(Log.ERROR, e.getMessage());
			}
				
		}
			
	});
		
container.connect(id, null);
		


DistributedEventAdmin works fine, but I am getting the following exception thrown on the call to container.connect() which is preventing the callback to handleServiceEvent of IRemoteServiceListener:

java.lang.NoClassDefFoundError: org/eclipse/ecf/remoteservice/IRemoteServiceCallPolicy
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2440)
at java.lang.Class.getDeclaredMethods(Class.java:1806)
at org.eclipse.ecf.core.util.reflection.ClassUtil.getDeclaredMethod(ClassUtil.java:62)
at org.eclipse.ecf.core.sharedobject.SharedObjectMsg.findMethod(SharedObjectMsg.java:156)
at org.eclipse.ecf.core.sharedobject.SharedObjectMsg.findMethodRecursive(SharedObjectMsg.java:188)
at org.eclipse.ecf.core.sharedobject.SharedObjectMsg.findMethodRecursive(SharedObjectMsg.java:286)
at org.eclipse.ecf.core.sharedobject.SharedObjectMsg.doInvoke(SharedObjectMsg.java:301)
at org.eclipse.ecf.core.sharedobject.SharedObjectMsg.invoke(SharedObjectMsg.java:290)
at org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject.handleSharedObjectMsg(RegistrySharedObject.java:1767)
at org.eclipse.ecf.core.sharedobject.BaseSharedObject.handleSharedObjectMsgEvent(BaseSharedObject.java:455)
at org.eclipse.ecf.core.sharedobject.SharedObjectMsgEventProcessor.processSharedObjectMsgEvent(SharedObjectMsgEventProcessor.java:41)
at org.eclipse.ecf.core.sharedobject.SharedObjectMsgEventProcessor.processEvent(SharedObjectMsgEventProcessor.java:36)
at org.eclipse.ecf.core.sharedobject.BaseSharedObject.fireEventProcessors(BaseSharedObject.java:190)
at org.eclipse.ecf.core.sharedobject.BaseSharedObject.handleEvent(BaseSharedObject.java:126)
at org.eclipse.ecf.provider.generic.SOWrapper.svc(SOWrapper.java:182)
at org.eclipse.ecf.provider.generic.SOWrapper$2.run(SOWrapper.java:138)
at java.lang.Thread.run(Thread.java:717)
Caused by: java.lang.ClassNotFoundException: org.eclipse.ecf.remoteservice.IRemoteServiceCallPolicy
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:355)
... 18 more

I have dependencies on both SharedObject and RemoteService in my bundle.
Any ideas?
Thanks
Robert
Re: Exception using RemoteServices [message #1044257 is a reply to message #1044228] Thu, 18 April 2013 17:21 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1038
Registered: July 2009
Senior Member
Hi Robert,

Clearly, it's failing to load IRemoteServiceCallPolicy.

Caused by: java.lang.ClassNotFoundException: org.eclipse.ecf.remoteservice.IRemoteServiceCallPolicy

The obvious next question is: why?

In the latest version, IRemoteServiceCallPolicy class is present in org.eclipse.ecf.remoteservice package. Is it possible you are using an old version of ECF on the message receiver side...where that interface isn't present?

Do you have any more of the 'cause' stack trace...i.e. below the ... 18 more ? I'm wanting to understand who is loading this class...and hoping to get at why the loading is failing. Is there something about your runtime environment that is unique? (e.g. using Felix rather than Equinox...or some other framework?)

One thing to try...add an Import-Package: org.eclipse.ecf.remoteservice to your bundle and try. I can't immediately understand why this would be necessary...as org.eclipse.ecf.provider.remoteservice has an Import-Package dependency on org.eclipse.ecf.remoteservice, but if it works in your environment then we can use that info to diagnose further.


Thanks,

Scott

Re: Exception using RemoteServices [message #1044297 is a reply to message #1044257] Thu, 18 April 2013 18:31 Go to previous message
Robert Onslow is currently offline Robert OnslowFriend
Messages: 13
Registered: April 2010
Junior Member
Silly question Scott, but how can I expand on the stacktrace in the Eclipse console?
Previous Topic:ApacheMQ Provider
Next Topic:ECF and MessageQueues
Goto Forum:
  


Current Time: Fri Apr 19 22:12:28 GMT 2024

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

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

Back to the top