On 22/01/2008, Han Liu <[EMAIL PROTECTED]> wrote: > > The NoClassDefFoundError: org/osgi/framework/BundleActivator > > I got the exception below > > org.osgi.framework.BundleException: Activator start error. > at org.apache.felix.framework.Felix._startBundle(Felix.java:1580) > at org.apache.felix.framework.Felix.startBundle(Felix.java:1470) > at org.apache.felix.framework.BundleImpl.start(BundleImpl.java > :354) > at org.apache.felix.shell.impl.StartCommandImpl.execute( > StartCommandImpl.java:82) > at > org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand( > Activator.java:265) > at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run( > Activator.java:167) > at java.lang.Thread.run(Thread.java:619) > Caused by: java.lang.NoClassDefFoundError: > org/osgi/framework/BundleActivator > at java.lang.ClassLoader.defineClass1(Native Method) > at java.lang.ClassLoader.defineClass(ClassLoader.java:620) > at > org.apache.felix.framework.searchpolicy.ContentClassLoader.findClass( > ContentClassLoader.java:162) > at > org.apache.felix.framework.searchpolicy.ContentClassLoader.loadClassFromModule > (ContentClassLoader.java:51) > at > org.apache.felix.framework.searchpolicy.ContentLoaderImpl.getClass( > ContentLoaderImpl.java:121) > at > org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource > (R4SearchPolicyCore.java:397) > at > org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass( > R4SearchPolicyCore.java:175) > at > org.apache.felix.framework.searchpolicy.R4SearchPolicy.findClass( > R4SearchPolicy.java:45) > at org.apache.felix.moduleloader.ModuleImpl.getClass( > ModuleImpl.java:152) > at org.apache.felix.framework.Felix.createBundleActivator( > Felix.java:3426) > at org.apache.felix.framework.Felix._startBundle(Felix.java:1531) > ... 6 more > java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator
can you tell us which version of Felix you are using, ie. 0.8.0 or 1.0.1? as well as how you're starting Felix - for example 'java -jar bin/felix.jar' the manifest file is > > Bundle-Name: English dictionary > Bundle-Description: A bundle that registers an English dictionary service > Bundle-Vendor: Apache Felix > Bundle-Version: 1.0.0 > Bundle-Activator: example.dictionary.Activator > Import-Package: org.osgi.framework FYI, this is an R3 manifest: ie. it doesn't contain a Bundle-SymbolicName or Bundle-ManifestVersion:2 - however, Felix should still be able to install and start it (the current OSGi spec is R4.1) I created a bundle with the same manifest and it starts using Felix 1.0.1 and there is nothing special in example.dictionary.Activator (It is a > copy of the example) > > > I'm a starter, and I'm so upset to meet the problem. I am using JDK6 if you're new to OSGi then you might want to try Neil's OSGi tutorial: http://neilbartlett.name/blog/osgi-articles or you could look at using Pax-Construct to generate example bundles: http://www.ops4j.org/projects/pax/construct this will use the bundleplugin to generate and verify the OSGi manifest: http://felix.apache.org/site/maven-bundle-plugin-bnd.html 2 Is that the contexts in each bundle activator's start method are > different? yes, a different BundleContext will be passed to each bundles' start method from the spec: "A BundleContext object represents the execution context of a single bundle within the OSGi Service Platform" 3 How to install a bundle in program without typing command in the shell. use a deployment service - for example Felix has a GUI shell, but you need to compile from trunk ( https://svn.apache.org/repos/asf/felix/trunk/shell.gui) alternatively Knopflerfish has a HTTP bundle for installing other bundles: https://www.knopflerfish.org/svn/knopflerfish.org/trunk/osgi/bundles/http/httpconsole/readme.html or you could use Eclipse/PDE with the Pax-Cursor provisioning plugin: http://wiki.ops4j.org/confluence/display/ops4j/Pax+Cursor http://wiki.ops4j.org/confluence/display/ops4j/Pax+Runner this lets you deploy bundles to all the major open-source OSGi frameworks HTH --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Cheers, Stuart

