On 1/13/10 12:40, Renaud Pelissier wrote:
Hello,
This is a second post about ClassCastException when running my bundle.
I am running my Bundle and I get a "Activator start error" with a
ClassCastException:
java.lang.ClassCastException: fr.numvision.kernel.sat.KernelActivator
cannot be cast to org.osgi.framework.BundleActivator
I don't understand this error because
fr.numvision.kernel.sat.KernelActivator IMPLEMENTS
org.osgi.framework.BundleActivator.
There error is telling you that you have two copies of the
BundleActivator class loaded into your VM somehow. The framework is
using one and your bundle is using another.
Do you have any other bundles exporting org.osgi.framework? Where is
your bundle getting this package from? If you issue the following
command in the Felix shell you can see the wiring:
inspect package requirement <bundle-id>
or shortened to:
inspect p r <bundle-id>
Where <bundle-id> is the ID of your bundle, then you should see from
where it is getting org.osgi.framework. If it is not the system bundle
(org.apache.felix.framework), then you have an issue.
You might also have mistakenly embedded this package into your bundle
and you are not importing it at all, which would also be an issue.
-> richard
Any idea?
Regards,
Renaud
package fr.numvision.kernel.sat;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import fr.numvision.common.NumVisionException;
import fr.numvision.kernel.IterativeRunner;
import fr.numvision.kernel.Logger;
import fr.numvision.kernel.Logger.LoggingLevel;
import fr.numvision.networkdiscovery.sat.BoxListener;
public class KernelActivator implements BundleActivator{
private Thread boxListenerTread=null;
@Override
public void start(BundleContext context) throws Exception {
Logger.createGlobalConsoleLogger();
Logger.log(this,"Logger was configured properly",
LoggingLevel.INFO);
System.out.println("STARTING");
NumVisionException exception=new NumVisionException();
System.out.println(exception);
Logger.createLogger("kernel",new
String[]{"fr.numvision.kernel","fr.numvision.networkdiscovery"},ConfigDAO.dirLog);
BoxListener boxListener=new BoxListener();
IterativeRunner iterativeRunner=new IterativeRunner(boxListener,
ConfigDAO.getBoxListenerSleepDelay());
boxListenerTread=new Thread(iterativeRunner);
boxListenerTread.start();
}
@Override
public void stop(BundleContext arg0) throws Exception {
boxListenerTread.interrupt();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]