[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ecf-dev] NoClassDefFoundError when using Remote Services

I'm trying to create my first Remote Service. Below is the activator that I'm using. When I try to start the bundle I get the error as per the log. I tried to google, but no success. Any suggestions?

package com.nsn.playground.osgi.dosgiserver;

import org.eclipse.ecf.core.ContainerFactory;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.IContainerManager;
import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter;
import org.eclipse.ecf.remoteservice.IRemoteServiceRegistration;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;

import com.nsn.playground.osgi.dosgiinterface.RandomNumberServer;

public class ServerActivator implements BundleActivator {
  private BundleContext context;
  private ServiceTracker containerManagerServiceTracker;
  private IContainer container;
  private IRemoteServiceRegistration serviceRegistration;

  // private ServiceRegistration registration;

  public void start(BundleContext context) throws Exception {
    this.context = context;

    // Setting up R-OSGI container
    IContainerManager containerManager = getContainerManagerService();
    container = ContainerFactory.getDefault().createContainer("ecf.r_osgi.peer");

    // Registering the service
    IRemoteServiceContainerAdapter containerAdapter = (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class);
    serviceRegistration = containerAdapter.registerRemoteService(new String[] { RandomNumberServer.class.getName() }, new RandomNumberServerImpl(),
	null);
    System.out.println("RandomNumberServer service registered.");
  }

  public void stop(BundleContext context) throws Exception {
    if (serviceRegistration != null) {
      serviceRegistration.unregister();
      serviceRegistration = null;
    }
    if (container != null) {
      container.disconnect();
      container = null;
    }
    if (containerManagerServiceTracker != null) {
      containerManagerServiceTracker.close();
      containerManagerServiceTracker = null;
    }
    this.context = null;
  }

  private IContainerManager getContainerManagerService() {
    if (containerManagerServiceTracker == null) {
      containerManagerServiceTracker = new ServiceTracker(context, IContainerManager.class.getName(), null);
      containerManagerServiceTracker.open();
    }
    return (IContainerManager) containerManagerServiceTracker.getService();
  }
}

///// osgi console

osgi> ss

Framework is launched.

id	State       Bundle
0	ACTIVE      org.eclipse.osgi_3.5.1.R35x_v20090827
1	ACTIVE      org.eclipse.ecf.remoteservice_1.0.0.v20070627-1030
13	ACTIVE      org.eclipse.equinox.common_3.5.1.R35x_v20090807-1100
14	ACTIVE      org.eclipse.equinox.registry_3.4.100.v20090520-1800
15	ACTIVE      org.eclipse.ecf.identity_3.0.0.v20090831-1906
16	ACTIVE      org.eclipse.osgi.services_3.2.0.v20090520-1800
18	ACTIVE      org.eclipse.core.runtime_3.5.0.v20090525
19	ACTIVE      org.eclipse.core.jobs_3.4.100.v20090429-1800
20	ACTIVE      org.eclipse.equinox.preferences_3.2.300.v20090520-1800
21	ACTIVE      org.eclipse.core.contenttype_3.4.1.R35x_v20090826-0451
22	ACTIVE      org.eclipse.equinox.app_1.2.0.v20090520-1800
23	ACTIVE      ch.ethz.iks.r_osgi.service_discovery.slp_1.0.0.RC4
24	ACTIVE      ch.ethz.iks.r_osgi.remote_1.0.0.RC4
26	ACTIVE      ch.ethz.iks.slp_1.0.0.RC5
27	ACTIVE      com.nsn.playground.osgi.dosgi-interface_1.0.0
29	ACTIVE      org.eclipse.ecf.provider.r_osgi_3.1.0.v20100913-1814
30	ACTIVE      org.eclipse.ecf_3.1.0.v20100913-1814
31	ACTIVE      org.eclipse.ecf.provider_3.0.0.v20100913-1814
32	ACTIVE      org.eclipse.ecf.sharedobject_2.2.100.v20100913-1814
33	ACTIVE      org.eclipse.equinox.concurrent_1.0.100.v20100503
35	RESOLVED    com.nsn.playground.osgi.dosgi-server_1.0.0

osgi> start 35
org.osgi.framework.BundleException: Exception in com.nsn.playground.osgi.dosgiserver.ServerActivator.start() of bundle com.nsn.playground.osgi.dosgi-server.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)
	at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:253)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:303)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:288)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:224)
	at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/ecf/remoteservice/RemoteServiceID
	at org.eclipse.ecf.provider.r_osgi.identity.R_OSGiRemoteServiceNamespace.createInstance(R_OSGiRemoteServiceNamespace.java:30)
	at org.eclipse.ecf.core.identity.IDFactory.createID(IDFactory.java:267)
	at org.eclipse.ecf.internal.provider.r_osgi.R_OSGiRemoteServiceContainer.createRemoteServiceID(R_OSGiRemoteServiceContainer.java:352)
	at org.eclipse.ecf.internal.provider.r_osgi.R_OSGiRemoteServiceContainer.registerRemoteService(R_OSGiRemoteServiceContainer.java:410)
	at com.nsn.playground.osgi.dosgiserver.ServerActivator.start(ServerActivator.java:31)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
	... 13 more
Nested Exception:
java.lang.NoClassDefFoundError: org/eclipse/ecf/remoteservice/RemoteServiceID
	at org.eclipse.ecf.provider.r_osgi.identity.R_OSGiRemoteServiceNamespace.createInstance(R_OSGiRemoteServiceNamespace.java:30)
	at org.eclipse.ecf.core.identity.IDFactory.createID(IDFactory.java:267)
	at org.eclipse.ecf.internal.provider.r_osgi.R_OSGiRemoteServiceContainer.createRemoteServiceID(R_OSGiRemoteServiceContainer.java:352)
	at org.eclipse.ecf.internal.provider.r_osgi.R_OSGiRemoteServiceContainer.registerRemoteService(R_OSGiRemoteServiceContainer.java:410)
	at com.nsn.playground.osgi.dosgiserver.ServerActivator.start(ServerActivator.java:31)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)
	at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:253)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:303)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:288)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:224)
	at java.lang.Thread.run(Thread.java:637)
Nested Exception:
java.lang.NoClassDefFoundError: org/eclipse/ecf/remoteservice/RemoteServiceID
	at org.eclipse.ecf.provider.r_osgi.identity.R_OSGiRemoteServiceNamespace.createInstance(R_OSGiRemoteServiceNamespace.java:30)
	at org.eclipse.ecf.core.identity.IDFactory.createID(IDFactory.java:267)
	at org.eclipse.ecf.internal.provider.r_osgi.R_OSGiRemoteServiceContainer.createRemoteServiceID(R_OSGiRemoteServiceContainer.java:352)
	at org.eclipse.ecf.internal.provider.r_osgi.R_OSGiRemoteServiceContainer.registerRemoteService(R_OSGiRemoteServiceContainer.java:410)
	at com.nsn.playground.osgi.dosgiserver.ServerActivator.start(ServerActivator.java:31)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)
	at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:253)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:303)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:288)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:224)
	at java.lang.Thread.run(Thread.java:637)