Hello Richard, Thank you so much for your answer. Yes you were right I forgot to import the org.osgi.framework package. It was the right solution.
But now I have a new problem of java.lang.NoClassDefFoundError: org/saxpath/SAXPathException wich I do not understand because the Jar is embedded in the Bundle and is in the class Path. Thanks again, Regards, Renaud *The listing of my bundle:* META-INF\MANIFEST.MF META-INF META-INF\maven META-INF\maven\fr.numvision META-INF\maven\fr.numvision\kernel META-INF\maven\fr.numvision\kernel\pom.properties META-INF\maven\fr.numvision\kernel\pom.xml cron4j-2.1.1.jar fr fr\numvision fr\numvision\kernel fr\numvision\kernel\CronRunner$CronRunnerTask.class fr\numvision\kernel\CronRunner.class fr\numvision\kernel\IterativeRunner.class fr\numvision\kernel\Logger$1.class fr\numvision\kernel\Logger$LoggingLevel.class fr\numvision\kernel\Logger.class fr\numvision\kernel\ServiceRunnable.class fr\numvision\kernel\box fr\numvision\kernel\box\ConfigDAO.class fr\numvision\kernel\box\KernelActivator.class fr\numvision\kernel\sat fr\numvision\kernel\sat\ConfigDAO.class fr\numvision\kernel\sat\Host$HostType.class fr\numvision\kernel\sat\Host.class fr\numvision\kernel\sat\Informer.class fr\numvision\kernel\sat\Installer$IdFactory.class fr\numvision\kernel\sat\Installer.class fr\numvision\kernel\sat\KernelActivator.class fr\numvision\kernel\supervision fr\numvision\kernel\supervision\ConfigDAO.class fr\numvision\networkdiscovery fr\numvision\networkdiscovery\box fr\numvision\networkdiscovery\box\Broadcaster.class fr\numvision\networkdiscovery\sat fr\numvision\networkdiscovery\sat\BoxListener.class jaxen-core-1.0-FCS.jar jaxen-jdom-1.0-FCS.jar jdom-1.1.jar log4j-1.2.13.jar saxpath-1.0-FCS.jar *The content of the MANIFEST:* Manifest-Version: 1.0 Export-Package: fr.numvision.networkdiscovery.sat;uses:="fr.numvision. common.xml,fr.numvision.kernel,fr.numvision.common,fr.numvision.kerne l.sat",fr.numvision.kernel,fr.numvision.kernel.box;uses:="fr.numvisio n.common.xml,fr.numvision.kernel,fr.numvision.networkdiscovery.box,or g.osgi.framework",fr.numvision.networkdiscovery.box;uses:="fr.numvisi on.kernel,fr.numvision.kernel.box",fr.numvision.kernel.supervision,fr .numvision.kernel.sat;uses:="fr.numvision.common.xml,fr.numvision.com mon,fr.numvision.common.ssh,fr.numvision.common.windows,fr.numvision. kernel,fr.numvision.networkdiscovery.sat,org.osgi.framework" Private-Package: org.apache.log4j.net,org.apache.log4j.lf5.util,org.ja xen.pattern,org.apache.log4j.lf5.viewer,org.apache.log4j.jmx,org.apac he.log4j.jdbc,org.apache.log4j.config,org.apache.log4j.helpers,org.ap ache.log4j,org.jaxen.jdom,org.saxpath.conformance,org.apache.log4j.or .jms,org.apache.log4j.lf5.config,org.apache.log4j.spi,org.apache.log4 j.nt,org.saxpath,org.jdom.xpath,com.werken.saxpath,org.apache.log4j.l f5,org.apache.log4j.xml,org.apache.log4j.chainsaw,org.jaxen,org.jdom, org.jdom.transform,org.jaxen.expr,org.jaxen.expr.iter,org.apache.log4 j.lf5.viewer.images,it.sauronsoftware.cron4j,org.jdom.output,org.jdom .input,org.jdom.filter,org.apache.log4j.or.sax,.,org.apache.log4j.lf5 .viewer.categoryexplorer,org.jaxen.util,org.jaxen.function.ext,org.ap ache.log4j.or,org.saxpath.helpers,org.jaxen.function,org.apache.log4j .varia,org.jdom.adapters,org.apache.log4j.lf5.viewer.configure Bundle-ClassPath: .,cron4j-2.1.1.jar,saxpath-1.0-FCS.jar,jaxen-jdom-1. 0-FCS.jar,jdom-1.1.jar,jaxen-core-1.0-FCS.jar,log4j-1.2.13.jar Built-By: renaud Tool: Bnd-0.0.311 Bundle-Name: kernel Created-By: Apache Maven Bundle Plugin Build-Jdk: 1.6.0_17 Bundle-Version: 2.0 Bnd-LastModified: 1263408980776 Bundle-ManifestVersion: 2 Bundle-Activator: fr.numvision.kernel.sat.KernelActivator Embed-Dependency: *;scope=compile|runtime Import-Package: com.sun.jdmk.comm;resolution:=optional,fr.numvision.co mmon;resolution:=optional,fr.numvision.common.ssh;resolution:=optiona l,fr.numvision.common.windows;resolution:=optional,fr.numvision.commo n.xml;resolution:=optional,fr.numvision.kernel;resolution:=optional,f r.numvision.kernel.box;resolution:=optional,fr.numvision.kernel.sat;r esolution:=optional,fr.numvision.kernel.supervision;resolution:=optio nal,fr.numvision.networkdiscovery.box;resolution:=optional,fr.numvisi on.networkdiscovery.sat;resolution:=optional,javax.jms;resolution:=op tional,javax.mail;resolution:=optional,javax.mail.internet;resolution :=optional,javax.management;resolution:=optional,javax.naming;resolut ion:=optional,javax.swing;resolution:=optional,javax.swing.border;res olution:=optional,javax.swing.event;resolution:=optional,javax.swing. table;resolution:=optional,javax.swing.text;resolution:=optional,java x.swing.tree;resolution:=optional,javax.xml.parsers;resolution:=optio nal,javax.xml.transform;resolution:=optional,javax.xml.transform.sax; resolution:=optional,javax.xml.transform.stream;resolution:=optional, oracle.xml.parser;resolution:=optional,oracle.xml.parser.v2;resolutio n:=optional,org.apache.xerces.dom;resolution:=optional,org.apache.xer ces.parsers;resolution:=optional,org.osgi.framework,org.w3c.dom;resol ution:=optional,org.xml.sax;resolution:=optional,org.xml.sax.ext;reso lution:=optional,org.xml.sax.helpers;resolution:=optional Bundle-SymbolicName: fr.numvision.kernel 2010/1/13 Richard S. Hall <[email protected]> > 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] >

