[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-core-dev] Bundle installed without Eclipse can't be unresolved
|
Hi,
I try to start osgi without eclipse, and install and start my simple bundle with the code as folows:
--------------------------------------------------------------------
package com.mabo.foo;
import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
import org.eclipse.osgi.framework.internal.core.OSGi;
import org.eclipse.osgi.framework.internal.defaultadaptor.DefaultAdaptor;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
public class FooStarter {
private static final String BUNDLE_URL = "file:/e:/temp/foobundle.jar";
private FrameworkAdaptor adaptor;
private OSGi osgi;
private BundleContext context;
public FooStarter(String[] args) {
adaptor = new DefaultAdaptor(args);
osgi = new OSGi(adaptor);
context = osgi.getBundleContext();
}
public void start() {
this.osgi.launch();
installBundle();
printInstalledBundles();
startBundles();
}
private void startBundles() {
Bundle[] bundles = context.getBundles();
for (int i = 0; i < bundles.length; i++) {
Bundle bundle = bundles[i];
try {
bundle.start();
} catch (BundleException e) {
System.err.println("Error during starting...");
e.printStackTrace();
}
}
}
private void installBundle() {
try {
context.installBundle(BUNDLE_URL);
} catch (BundleException e) {
System.err.println("Error during installing...");
e.printStackTrace();
}
}
private void printInstalledBundles() {
System.out.println("print installed bundles...");
Bundle[] installed = context.getBundles();
System.out.println(installed.length);
for (int idx = 0; idx < installed.length; idx++) {
System.out.println("Symb name = "
+ installed[idx].getSymbolicName());
}
System.out.println("done");
}
public static void main(String[] args) {
FooStarter starter = new FooStarter(args);
starter.start();
}
} ///:~
--------------------------------------------------------------------
But got error msg as follows: (the bundle did get installed! but can't be resolved)
--------------------------------------------------------------------
print installed bundles...
2
Symb name = system.bundle
Symb name = com.mabo.foo
done
Error during starting...
org.osgi.framework.BundleException: The bundle could not be resolved.
Reason: missing required bundle org.eclipse.core.runtime_0.0.0
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:296)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:266)
at com.mabo.foo.FooStarter.startBundles(FooStarter.java:36)
at com.mabo.foo.FooStarter.start(FooStarter.java:28)
at com.mabo.foo.FooStarter.main(FooStarter.java:66)
--------------------------------------------------------------------
I have added the required jar files to classpath, project build path and
the final bundle jar file in lib dir (but not inclueded in the attachment)
and in the manifest, wrote the required bundle org.eclipse.core.runtime
for version "3.1.0" how came up "org.eclipse.core.runtime_0.0.0"?
This puzzled me a lot! :(
I attached the src code with the mail.
Best regards
-Birkey
Attachment:
com.mabo.foo.rar
Description: Binary data