You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Renaud Pelissier <re...@gmail.com> on 2010/01/13 18:40:28 UTC
Activator start error, ClassCastException: xxxx cannot be cast to
org.osgi.framework.BundleActivator
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.
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();
> }
>
> }
>
Re: Activator start error, ClassCastException: xxxx cannot be cast to
org.osgi.framework.BundleActivator
Posted by Renaud Pelissier <re...@gmail.com>.
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 <he...@ungoverned.org>
> 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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
Re: Activator start error, ClassCastException: xxxx cannot be cast to
org.osgi.framework.BundleActivator
Posted by Justin Edelson <ju...@gmail.com>.
This just means you also need to bundle saxpath.
FWIW, there's an OSGi bundle for JDOM in the SpringSource repository:
http://www.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.jdom&version=1.1.0&searchType=bundlesByName&searchQuery=jdom
Justin
On Wed, Jan 13, 2010 at 2:42 PM, Renaud Pelissier <
renaud.pelissier.numvision@gmail.com> wrote:
> Hi Richard,
>
> I am under the impression that JDOM is again responsible for my problem.
> The problem comes when calling
> org.jdom.xpath.XPath.newInstance(XPath.java:134).
>
> What do you think, should I just change my XML library and the drop this
> JDOM that is making me crazy by not having a regular dependancies tree
> (that
> causes BND to generate a stupid MANIFEST)?
>
> Regards,
>
> Renaud
>
>
>
> org.osgi.framework.BundleException: Activator start error in bundle
> fr.numvision.kernel [18].
> at org.apache.felix.framework.Felix.activateBundle(Felix.java:1751)
> at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
> at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
> at
>
> org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:114)
> at
>
> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:286)
> at
>
> org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:184)
> at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> at
>
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1787)
> at
>
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:682)
> at
> org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:60)
> at
>
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1650)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Unknown Source)
> at org.jdom.xpath.XPath.newInstance(XPath.java:134)
> at fr.numvision.common.xml.XmlDAO.getElements(XmlDAO.java:343)
> at fr.numvision.common.xml.XmlDAO.getElement(XmlDAO.java:372)
> at fr.numvision.common.xml.XmlDAO.getString(XmlDAO.java:133)
> at fr.numvision.common.xml.XmlDAO.getInt(XmlDAO.java:94)
> at
>
> fr.numvision.kernel.sat.ConfigDAO.getBoxListenerSleepDelay(ConfigDAO.java:62)
> at
> fr.numvision.kernel.sat.KernelActivator.start(KernelActivator.java:28)
> at
>
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:639)
> at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
> ... 6 more
> Caused by: java.lang.ClassNotFoundException: org.saxpath.SAXPathException
> at
>
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:738)
> at
> org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:60)
> at
>
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1650)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> ... 25 more
> java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
>
>
>
> 2010/1/13 Richard S. Hall <he...@ungoverned.org>
>
> > 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: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
>
Re: Activator start error, ClassCastException: xxxx cannot be cast to
org.osgi.framework.BundleActivator
Posted by Renaud Pelissier <re...@gmail.com>.
Hi Richard,
I am under the impression that JDOM is again responsible for my problem.
The problem comes when calling
org.jdom.xpath.XPath.newInstance(XPath.java:134).
What do you think, should I just change my XML library and the drop this
JDOM that is making me crazy by not having a regular dependancies tree (that
causes BND to generate a stupid MANIFEST)?
Regards,
Renaud
org.osgi.framework.BundleException: Activator start error in bundle
fr.numvision.kernel [18].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1751)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
at
org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:114)
at
org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:286)
at
org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:184)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1787)
at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:682)
at
org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:60)
at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1650)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.jdom.xpath.XPath.newInstance(XPath.java:134)
at fr.numvision.common.xml.XmlDAO.getElements(XmlDAO.java:343)
at fr.numvision.common.xml.XmlDAO.getElement(XmlDAO.java:372)
at fr.numvision.common.xml.XmlDAO.getString(XmlDAO.java:133)
at fr.numvision.common.xml.XmlDAO.getInt(XmlDAO.java:94)
at
fr.numvision.kernel.sat.ConfigDAO.getBoxListenerSleepDelay(ConfigDAO.java:62)
at
fr.numvision.kernel.sat.KernelActivator.start(KernelActivator.java:28)
at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:639)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.saxpath.SAXPathException
at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:738)
at
org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:60)
at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1650)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 25 more
java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
2010/1/13 Richard S. Hall <he...@ungoverned.org>
> 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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
Re: Activator start error, ClassCastException: xxxx cannot be cast
to org.osgi.framework.BundleActivator
Posted by "Richard S. Hall" <he...@ungoverned.org>.
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: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org