Bug 108226 - WebStartMain does not correctly find framework bundle when org.eclipse.osgi.services bundle is included in deployment
Summary: WebStartMain does not correctly find framework bundle when org.eclipse.osgi.s...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: platform-runtime-inbox CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-28 15:56 EDT by ted stockwell CLA Friend
Modified: 2005-09-16 13:16 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ted stockwell CLA Friend 2005-08-28 15:56:03 EDT
I am trying to deploy an RCP application via Java WebStart.  I followed the
instructions in the "Deploying eclipse based application with Java Web Start"
item in the help system EXACTLY.  However, when I try to start the .jnlp nothing
happens.
I found this in the .log file in the configuration folder on the client...

java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:331)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
    at org.eclipse.core.launcher.WebStartMain.basicRun(WebStartMain.java:50)
    at org.eclipse.core.launcher.Main.run(Main.java:973)
    at org.eclipse.core.launcher.WebStartMain.main(WebStartMain.java:35)
 

---------------------

Turns out that the problem is that org.eclipse.core.launcher.WebStartMain does
not correctly find the framework bundle.
I discovered this by including -debug as an argument to WebStartMain and trapped
the output in the JWS console (no easy task ;-().  The following lines appeared
in the JWS console...

Framework located:
    file:/C:/Documents and Settings/ted stockwell/Application
Data/Sun/Java/Deployment/cache/javaws/file/D/P-1/DMC&c/DMtemp/DMcontrolexample/DMplugins/RMorg.eclipse.osgi.services_3.1.0.jar
Framework classpath:
    file:/C:/Documents and Settings/ted stockwell/Application
Data/Sun/Java/Deployment/cache/javaws/file/D/P-1/DMC&c/DMtemp/DMcontrolexample/DMplugins/RMorg.eclipse.osgi.services_3.1.0.jar


-------------------

I believe the problem is that I have included the org.eclipse.osgi.services
bundle in my 'wrapping' feature and that causes
org.eclipse.core.launcher.WebStartMain to miscalculate the framework bundle.

I think the problem is in the WebStartMain.searchFor method...

protected String searchFor(final String target, String start) {
       //The searching can be improved 
	String[] jars = getAllJars();
	ArrayList selected = new ArrayList(3);
	for (int i = 0; i < jars.length; i++) {
		if (jars[i].indexOf(target) != -1)
			selected.add(jars[i]);
	}
	if (selected.size() == 0)
		return null;

	String[] selectedJars = new String[selected.size()];
	for (int i = 0; i < selected.size(); i++) {
		selectedJars[i] = extractFileName((String) selected.get(i));
	}
	if (debug)
		System.out.println(extractInnerURL((String) selected.get(findMax(selectedJars))));
	return extractInnerURL((String) selected.get(findMax(selectedJars)));
	}


...notice that this method uses String.indexOf to identify a matching bundle. 
If it used String.equals instead then it would correctly find JUST the
org.eclipse.osgi plugin
Comment 1 Jeff McAffer CLA Friend 2005-08-28 21:14:26 EDT
sigh.  We should consider this one for 3.1.1
Comment 2 Pascal Rapicault CLA Friend 2005-08-29 23:20:19 EDT
The webstart code has been changed last week in the 3.1.1 build as well as in
HEAD. Could you please try again with either the latest I build from 3.2 or the
3.1.1 drop and let me know (you just need to grab the startup.jar)
Comment 3 Karice McIntyre CLA Friend 2005-09-15 12:14:18 EDT
What's the status of this bug for 3.1.1?  Is there any way we can verify the 
problem is fixed?
Comment 4 ted stockwell CLA Friend 2005-09-15 19:43:57 EDT
(In reply to comment #3)
> What's the status of this bug for 3.1.1?  Is there any way we can verify the 
> problem is fixed?

I downloaded the eclipse-SDK-M20050831-1200-win32 build and have verified that
the problem is fixed.
Comment 5 Karice McIntyre CLA Friend 2005-09-16 13:16:52 EDT
Closing, based on comment #4