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() {

  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);
		} catch (Exception x) {Log.log(Log.ERROR, x.getMessage());
		final ISharedObjectContainer soc = (ISharedObjectContainer) ((IAdaptable) container).getAdapter(ISharedObjectContainer.class);
		soc.addListener(new IContainerListener() {

			public void handleEvent(IContainerEvent event) {
				if (event instanceof IContainerConnectedEvent)
				try {
				ISharedObjectManager manager = soc.getSharedObjectManager();
				admin = new DistributedEventAdmin(context);
				ID id1 = IDFactory.getDefault().createStringID("");
				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(
at java.lang.Class.getDeclaredMethods(
at org.eclipse.ecf.core.util.reflection.ClassUtil.getDeclaredMethod(
at org.eclipse.ecf.core.sharedobject.SharedObjectMsg.findMethod(
at org.eclipse.ecf.core.sharedobject.SharedObjectMsg.findMethodRecursive(
at org.eclipse.ecf.core.sharedobject.SharedObjectMsg.findMethodRecursive(
at org.eclipse.ecf.core.sharedobject.SharedObjectMsg.doInvoke(
at org.eclipse.ecf.core.sharedobject.SharedObjectMsg.invoke(
at org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject.handleSharedObjectMsg(
at org.eclipse.ecf.core.sharedobject.BaseSharedObject.handleSharedObjectMsgEvent(
at org.eclipse.ecf.core.sharedobject.SharedObjectMsgEventProcessor.processSharedObjectMsgEvent(
at org.eclipse.ecf.core.sharedobject.SharedObjectMsgEventProcessor.processEvent(
at org.eclipse.ecf.core.sharedobject.BaseSharedObject.fireEventProcessors(
at org.eclipse.ecf.core.sharedobject.BaseSharedObject.handleEvent(
at org.eclipse.ecf.provider.generic.SOWrapper.svc(
at org.eclipse.ecf.provider.generic.SOWrapper$
Caused by: java.lang.ClassNotFoundException: org.eclipse.ecf.remoteservice.IRemoteServiceCallPolicy
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
... 18 more

I have dependencies on both SharedObject and RemoteService in my bundle.
Any ideas?
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 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.



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: Tue Jul 16 19:29:50 GMT 2024

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

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

Back to the top