FrameworkEvent ERROR when running Hello World OSGI package

I am new to OSGI. I completed the following tutorial to make a simple OSGI Hello World toolkit in eclipse. http://www.javaworld.com/javaworld/jw-03-2008/jw-03-osgi1.html?page=2

When I start a project, I get a bunch of errors in the console. The following errors are listed below:

osgi> !SESSION 2013-07-10 23:23:03.340 ----------------------------------------------- eclipse.buildId=unknown java.version=1.7.0_07 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Command-line arguments: -dev file:C:/Users/student/workspace/.metadata/.plugins/org.eclipse.pde.core/OSGi Framework/dev.properties -os win32 -ws win32 -arch x86 -consoleLog -console !ENTRY org.eclipse.debug.ui 4 0 2013-07-10 23:23:08.809 !MESSAGE FrameworkEvent ERROR !STACK 0 org.osgi.framework.BundleException: Exception in org.eclipse.debug.internal.ui.DebugUIPlugin.start() of bundle org.eclipse.debug.ui. at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390) at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1177) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544) at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457) at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) Caused by: java.lang.IllegalStateException: Workbench has not been created yet. at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92) at org.eclipse.debug.internal.ui.contextlaunching.LaunchingResourceManager.startup(LaunchingResourceManager.java:546) at org.eclipse.debug.internal.ui.DebugUIPlugin.getLaunchingResourceManager(DebugUIPlugin.java:357) at org.eclipse.debug.internal.ui.DebugUIPlugin.start(DebugUIPlugin.java:569) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702) ... 12 more Root exception: java.lang.IllegalStateException: Workbench has not been created yet. at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92) at org.eclipse.debug.internal.ui.contextlaunching.LaunchingResourceManager.startup(LaunchingResourceManager.java:546) at org.eclipse.debug.internal.ui.DebugUIPlugin.getLaunchingResourceManager(DebugUIPlugin.java:357) at org.eclipse.debug.internal.ui.DebugUIPlugin.start(DebugUIPlugin.java:569) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390) at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1177) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544) at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457) at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) !ENTRY org.eclipse.equinox.p2.core 4 0 2013-07-10 23:23:10.114 !MESSAGE Provisioning exception !STACK 1 and other similar errors.... 

Could you help me fix this? Thanks.

+4
source share
5 answers

I'm late to the party, but I ran into the same problem trying to create Hello World from the javaworld tutorial using eclipse 4.2.

When I deselected all packages in the target platform and clicked "Add required bundles", the eclipse only selected

 org.eclipse.osgi 

I got an error when starting

 org.osgi.framework.BundleException: Could not find bundle: org.eclipse.equinox.console 

Adding a console and adding the required bindings

 javax.servlet org.apache.felix.gogo.runtime org.eclipse.osgi.services 

along with org.eclipse.osgi

Running this configuration led to

 org.osgi.framework.BundleException: Missing required bundle: org.apache.felix.gogo.shell 

Finally adding

 org.apache.felix.gogo.shell 

got what i expected.

 Hello World!! osgi> ss "Framework is launched." id State Bundle 0 ACTIVE org.eclipse.osgi_3.9.0.v20130529-1710 1 ACTIVE com.javaworld.sample.HelloWorld_1.0.0.qualifier 8 ACTIVE org.apache.felix.gogo.runtime_0.10.0.v201209301036 9 ACTIVE org.eclipse.equinox.console_1.0.100.v20130429-0953 10 ACTIVE javax.servlet_3.0.0.v201112011016 11 ACTIVE org.eclipse.osgi.services_3.3.100.v20130513-1956 12 ACTIVE org.apache.felix.gogo.shell_0.10.0.v201212101605 osgi> 
+6
source

I fought a lot for "Workbench not yet created" all day.

But I got the solution using the following steps .-

  • Go to Run Configuration → Remove all containers of the target platform.
  • Click to add the required packages.
  • Check org.apache.felix.gogo.runtime, org.apache.felix.gogo.shell, org.eclipse.eqinox.console, org.eclipse.osgi and the JAR file.
  • The last and important step. Go to Settings, check the box "Clear configuration area before starting ."
  • Launch the OSGi application.
  • Enjoy if this works for you, as it worked for me.

thanks

+6
source

The error occurs when you run unnecessary packages from the target platform. Therefore, only the necessary packages are selected.

Just when configuring Run Configuration, follow these steps:

  • On the Bindings tab, first click Unselect. This will deselect all packages from your workspace, as well as from the target platform.
  • Now, on the same tab, from the tree structure of the workspace, select your own created package. After that, click on "Add Required Links". This will add the necessary packages from the target platform. You can also check to see if all dependencies are satisfied by clicking "Check Links".
  • Now save the configuration and run. Your bundle will be launched and all other disturbing bundles will be skipped.
0
source

I had the same problem. I managed to launch my package by creating a new launch configuration and deselecting all the packages, adding my package and then clicking “Add Required Bundles”.

I do not know why this second configuration works and the first does not work, I looked at both .launch files and they are identical.

What seems to be happening is that in one config run all available packages are executed, although only three are selected in gui. If you enter the ss command in the osgi console after all the errors are complete, I get 1182 bundles running for the broken startup configuration, where, since the working configuration just gives me the correct 3.

You should try to create a new launch configuration and see if it sorts it, I don’t know why the new one works for me, but it is so, I hope this helps.

The output of the working ss configuration:

 id State Bundle 0 ACTIVE org.eclipse.osgi_3.7.2.dist Fragments=1 1 RESOLVED javax.transaction_1.1.1.v201105210645 Master=0 2 ACTIVE com.javaworld.sample.HelloWorld_1.0.0.qualifier 

The last few lines of the broken ss configuration:

 1040 ACTIVE org.sonatype.m2e.mavenarchiver_0.15.0.201212080009 1041 ACTIVE org.testng.eclipse_6.8.0.20121120_1820 1042 ACTIVE org.uddi4j_2.0.5.v200805270300 1043 ACTIVE org.w3c.css.sac_1.3.0.v200805290154 1044 ACTIVE org.w3c.dom.smil_1.0.0.v200806040011 1045 ACTIVE org.w3c.dom.svg_1.1.0.v201011041433 1046 ACTIVE org.w3c.sac_1.3.0.v20120213 1155 <<LAZY>> org.eclipse.equinox.simpleconfigurator_1.0.200.dist 1182 <<LAZY>> org.eclipse.equinox.initializer_1.0.0.dist 
0
source

Setting android: targetSdkVersion = "19 solved the problem for me.

0
source

Source: https://habr.com/ru/post/1490785/


All Articles