Home » Eclipse Projects » Equinox » Start Equinox using Reflection 
| Start Equinox using Reflection [message #94365] | 
Tue, 07 August 2007 10:05   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
I am trying to start the equinox launcher using reflection. I am detecting the location of the current jar file and calculate the path to the org.eclipse.equinox.launcher.jar file(works!). 
 
I am using System Properties to set the osgi.framework path: 
System.getProperties().put("osgi.framework", path+"bin/plugins/org.eclipse.osgi.jar");Then i invoke the Main method(org.eclipse.equinox.launcher.Main.main(args)). This works too: 
 
<i>Install location: 
    file:/c:/Documents and Settings/Administrator/Application  Data/Sun/Java/Deployment/cache/javaws/http/Dowen/P8181/DMcli ent/bin/ 
Configuration file: 
    file:/c:/Documents and Settings/Administrator/Application  Data/Sun/Java/Deployment/cache/javaws/http/Dowen/P8181/DMcli ent/bin/configuration/config.ini loaded 
Configuration location: 
    file:/c:/Documents and Settings/Administrator/Application  Data/Sun/Java/Deployment/cache/javaws/http/Dowen/P8181/DMcli ent/bin/configuration/ 
Framework located: 
    file:/C:/Documents and Settings/Administrator/Application  Data/Sun/Java/Deployment/cache/javaws/http/Dowen/P8181/DMcli ent/bin/plugins/org.eclipse.osgi.jar 
Framework classpath: 
    file:/C:/Documents and Settings/Administrator/Application  Data/Sun/Java/Deployment/cache/javaws/http/Dowen/P8181/DMcli ent/bin/plugins/org.eclipse.osgi.jar 
Debug options: 
    file:/C:/Documents and Settings/Administrator/Application  Data/Sun/Java/Deployment/cache/javaws/http/Dowen/P8181/DMcli ent/.options not found 
Time to load bundles: 1297</i> 
 
The config.ini contains this: 
<i>#Product Runtime Configuration File 
 
osgi.splashPath=platform:/base/ 
osgi.instance.area=@user.home/.test 
osgi.nl=en_US 
eclipse.product=myProduct.productId 
osgi.bundles=org.eclipse.equinox.common@2:start, org.eclipse.core.jobs@2:start, org.eclipse.equinox.registry@2:start, org.eclipse.equinox.preferences, org.eclipse.core.contenttype, org.eclipse.core.runtime@2:start, org.eclipse.equinox.app@2:start, org.eclipse.update.configurator@3:start, org.eclipse.core.runtime.compatibility.registry, org.eclipse.core.runtime.compatibility.auth, com.ibm.icu 
eof=eof</i> 
 
And thats the problem: I remove all folders from the configuration folder(only config.ini remains there). 
If i use the eclipse launcher exe to launch our application, everything works great(if i set osgi.framework in the config.ini), but if i use my class to launch the application i get this errormessage: 
<i> 
!SESSION 2007-08-07 15:55:40.812 ----------------------------------------------- 
eclipse.buildId=unknown 
java.version=1.5.0_08 
java.vendor=Sun Microsystems Inc. 
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US 
Command-line arguments:  -debug 
 
!ENTRY org.eclipse.equinox.common 4 0 2007-08-07 15:55:43.046 
!MESSAGE  
!STACK 0 
org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Permission: (org.osgi.framework.PackagePermission org.eclipse.osgi.framework.log export,import), Missing Constraint: Import-Package: org.eclipse.osgi.framework.log; version="0.0.0" 
	at  org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:305) 
	at  org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:350) 
	at  org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1118) 
	at  org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:634) 
	at  org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(StartLevelManager.java:508) 
	at  org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(StartLevelManager.java:282) 
	at  org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(StartLevelManager.java:468) 
	at  org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:195) 
	at  org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(EventManager.java:297) 
 
!ENTRY org.eclipse.core.jobs 4 0 2007-08-07 15:55:43.062 
!MESSAGE  
!STACK 0 
org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: Require-Bundle: org.eclipse.equinox.common; bundle-version=" was not resolved. 
!SUBENTRY 2 org.eclipse.equinox.common 2 0 2007-08-07 15:55:43.375 
!MESSAGE Missing Permission: (org.osgi.framework.PackagePermission org.eclipse.osgi.framework.log export,import) 
!SUBENTRY 2 org.eclipse.equinox.common 2 0 2007-08-07 15:55:43.375 
!MESSAGE Missing Constraint: Import-Package: org.eclipse.osgi.framework.log; version="0.0.0" 
!SUBENTRY 1 org.eclipse.osgi 2 0 2007-08-07 15:55:43.375 
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.core.jobs.jar/  was not resolved. 
!SUBENTRY 2 org.eclipse.core.jobs 2 0 2007-08-07 15:55:43.375 
!MESSAGE Missing required bundle org.eclipse.equinox.common_[3.2.0,4.0.0). 
!SUBENTRY 1 org.eclipse.osgi 2 0 2007-08-07 15:55:43.375 
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.registry.jar/ [3] was not resolved. 
!SUBENTRY 2 org.eclipse.equinox.registry 2 0 2007-08-07 15:55:43.375 
!MESSAGE Missing required bundle org.eclipse.equinox.common_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.equinox.registry 2 0 2007-08-07 15:55:43.375 
!MESSAGE Missing imported package org.eclipse.core.runtime.jobs_0.0.0. 
!SUBENTRY 1 org.eclipse.osgi 2 0 2007-08-07 15:55:43.375 
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.preferences.jar/ [4] was not resolved. 
!SUBENTRY 2 org.eclipse.equinox.preferences 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.common_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.equinox.preferences 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing optionally required bundle org.eclipse.equinox.registry_[3.2.0,4.0.0). 
!SUBENTRY 1 org.eclipse.osgi 2 0 2007-08-07 15:55:43.390 
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.core.contenttype.jar/ [5] was not resolved. 
!SUBENTRY 2 org.eclipse.core.contenttype 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.preferences_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.core.contenttype 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.registry_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.core.contenttype 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.common_[3.2.0,4.0.0). 
!SUBENTRY 1 org.eclipse.osgi 2 0 2007-08-07 15:55:43.390 
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.core.runtime.jar/ [6] was not resolved. 
!SUBENTRY 2 org.eclipse.core.runtime 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.common_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.core.runtime 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.core.jobs_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.core.runtime 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.registry_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.core.runtime 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.preferences_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.core.runtime 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.core.contenttype_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.core.runtime 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing optionally required bundle org.eclipse.core.runtime.compatibility.auth_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.core.runtime 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.app_[1.0.0,2.0.0). 
!SUBENTRY 1 org.eclipse.osgi 2 0 2007-08-07 15:55:43.390 
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.app.jar/ [7] was not resolved. 
!SUBENTRY 2 org.eclipse.equinox.app 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.registry_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.equinox.app 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.common_[3.2.0,4.0.0). 
!SUBENTRY 2 org.eclipse.equinox.app 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing imported package org.osgi.service.event_1.0.0. 
!SUBENTRY 2 org.eclipse.equinox.app 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing imported package org.osgi.service.event_1.0.0. 
!SUBENTRY 1 org.eclipse.osgi 2 0 2007-08-07 15:55:43.390 
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.update.configurator.jar/ [8] was not resolved. 
!SUBENTRY 2 org.eclipse.update.configurator 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.common_[3.2.0,4.0.0). 
!SUBENTRY 1 org.eclipse.osgi 2 0 2007-08-07 15:55:43.390 
!MESSAGE Bundle initial@reference :file:plugins/org.eclipse.core.runtime.compatibility.registr y/ [9] was not resolved. 
!SUBENTRY 2 org.eclipse.core.runtime.compatibility.registry 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing host org.eclipse.equinox.registry_[3.3.0,3.5.0). 
!SUBENTRY 1 org.eclipse.osgi 2 0 2007-08-07 15:55:43.390 
!MESSAGE Bundle initial@reference :file:plugins/org.eclipse.core.runtime.compatibility.auth.ja r/ [10] was not resolved. 
!SUBENTRY 2 org.eclipse.core.runtime.compatibility.auth 2 0 2007-08-07 15:55:43.390 
!MESSAGE Missing required bundle org.eclipse.equinox.common_[3.2.0,4.0.0).</i> 
 
And here's the funny thing: If i do not delete the folders in the configuration folder and try to launch my application using my java class everything works fine. 
 
Can anybody help me with the problem? 
Thanks Simon
 |  
 |  
  |   |   |  
| Re: Start Equinox using Reflection [message #94536 is a reply to message #94490] | 
Wed, 08 August 2007 02:59   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Thank you! It works now. 
My problem was: i wrote an application for java web start. A small jar contains the starter and a big jar file contains all necessary files. The starter extracts the big jar file and launches our application(yeah i know its not the normal way jws is used and it is a ugly solution, but we have some plugins, which are not in a jar file, therefore we have to do this). The Problem was: If i launch the WebStartMain the first statement is "System.setSecurityManager(null)". This is not allowed, because the jar file is not on the classpath. I wrote my own SecurityManager to avoid this problem and called the "org.eclipse.equinox.launcher.Main" function instead. But then the troubles began. Now i am just setting the SecurityManager to null in my starter application and everything works fine! 
 
Thanks again for your help 
Simon
 |  
 |  
  |   
Goto Forum:
 
 Current Time: Mon Nov 03 21:55:50 EST 2025 
 Powered by  FUDForum. Page generated in 0.08505 seconds  
 |