Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 447560

Summary: [JWS] [RCP] Startup fails with Java SE 7u71/72 & Java SE 8u25
Product: [Eclipse Project] Equinox Reporter: Michael Seele <mseele>
Component: LauncherAssignee: Project Inbox <equinox.launcher-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: arunkumar.thondapu, dmcreynolds, dominik.stadler, hongtao.zhao, jamie.wiles, markxjohnson, tjwatson
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Michael Seele CLA 2014-10-16 09:02:34 EDT
Since Java SE 7u71/72 & Java SE 8u25 trying to start an RCP application via Java Web Start fails with this exception:

java.lang.NoClassDefFoundError: org.eclipse.osgi.util.NLS
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:200)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.WebStartMain.basicRun(WebStartMain.java:79)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
    at org.eclipse.equinox.launcher.WebStartMain.main(WebStartMain.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.javaws.Launcher.executeApplication(Unknown Source)
    at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
    at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
    at com.sun.javaws.Launcher.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source) 

The underlying exception seems to be

java.security.AccessControlException: access denied ("java.util.PropertyPermission" "osgi.nls.warnings" "read")
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
    at org.eclipse.osgi.framework.internal.core.FrameworkProperties.getProperty(FrameworkProperties.java:50)
    at org.eclipse.osgi.framework.internal.core.FrameworkProperties.getProperty(FrameworkProperties.java:44)
    at org.eclipse.osgi.util.NLS.<clinit>(NLS.java:60)
    ... 25 more 

VM terminates without an error message.
Comment 1 Michael Seele CLA 2014-10-16 09:08:24 EDT
The workaround we found is to add 

<property name="osgi.parentClassloader" value="current"/>

to the jnlp file. This only works if the jnlp file is signed.
This appears to be an undocumented value that we found by debugging class org.eclipse.equinox.launcher.Main.

This works for org.eclipse.equinox.launcher_1.2.0.v20110502.jar (newer versions have not been tested)
Comment 2 Dylan McReynolds CLA 2014-10-16 09:21:44 EDT
Thanks for the details.

This solution would be painful for us, as we dynamically generate the jnlp in the server for some functions.

Just curious, how are you attaching to the debugger? I've tried by adding -J-Xdebug.... settings to a command line as I have done in the past, but with Java 7 update 72, this does not seem to be working.
Comment 3 Michael Seele CLA 2014-10-16 09:47:32 EDT
(In reply to Dylan McReynolds from comment #2)
> Just curious, how are you attaching to the debugger? I've tried by adding
> -J-Xdebug.... settings to a command line as I have done in the past, but
> with Java 7 update 72, this does not seem to be working.

You need to add
deployment.security.use.insecure.launcher=true
to the deployment.properties (http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/jcp/properties.html)

and run Java Web Start in that way

javaws.exe -J-Xdebug -J-Xnoagent -J-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 http://server:port/descriptor.jnlp

Please note:
- You need to launch the remote-debuging run in eclipse two times (the first time it exit's without launching the main method, the second time it runs the main method). Cause of suspend=y the process suspends in the first line as long as you do not launch the remote-debugging run
- without the deployment.security.use.insecure.launcher property all the remote debugging attributes will be ignored
Comment 4 Dylan McReynolds CLA 2014-10-16 12:46:29 EDT
I could never get the remote debug to work (the second pass never connected) but I did get my app back running...see this forum discussion if interested: 

https://www.eclipse.org/forums/index.php/m/1446298/#msg_1446298
Comment 5 Mark Johnson CLA 2014-10-21 16:41:31 EDT
(In reply to Michael Seele from comment #1)
> The workaround we found is to add 
> 
> <property name="osgi.parentClassloader" value="current"/>
> 
> to the jnlp file. This only works if the jnlp file is signed.
> This appears to be an undocumented value that we found by debugging class
> org.eclipse.equinox.launcher.Main.
> 
> This works for org.eclipse.equinox.launcher_1.2.0.v20110502.jar (newer
> versions have not been tested)

Thanks Michael, your workaround definitely saved us a whole lot of grief.

I also started to debug the launcher and noticed the following in org.eclipse.equinox.launcher.Main.invokeFramework:

String type = System.getProperty(PROP_FRAMEWORK_PARENT_CLASSLOADER, System.getProperty(PROP_PARENT_CLASSLOADER, PARENT_CLASSLOADER_BOOT));


So it is looking for the  osgi.frameworkParentClassloader property and if that's not set it defaults to the value of osgi.parentClassloader (with a default of boot)

At least for my app, I can just set:

<property name="osgi.frameworkParentClassloader" value="current"/>

which seems to have the same net effect as your workaround.

osgi.frameworkParentClassloader is documented as 'the classloader used to load the equinox launcher'
 
Hope this helps
Comment 6 Mark Johnson CLA 2014-10-23 14:34:27 EDT
In my last comment, I meant to add that

osgi.frameworkParentClassloader with a value of current is documented as 'the classloader used to load the equinox launcher'
Comment 7 Jamie Wiles CLA 2014-10-28 11:23:38 EDT
Adding <property name="jnlp.osgi.parentClassloader" value="current"/> didn't work for us, however we tried adding <property name="jnlp.eclipse.security" value="osgi" /> as described in this forum thread: https://www.eclipse.org/forums/index, and it appears to have fixed the issue.
Comment 8 Hongtao Zhao CLA 2014-11-06 01:09:24 EST
After added the paremter "jnlp.osgi.parentClassloader", my web start application can be launched now. But I find another performence problem. After investigation, I find the problem is root caused by an JFace interface: ColumnViewer.update(Object element, String[] properties). 

The interface response is very slow. It needs about 15~20 millisecond for web start application in my environment. However, it just needs nearly 0 milliseconds for installation application.

My RCP application is based on Eclipse 3.6SR1. Anyone has some ideas about it?
Comment 9 Hongtao Zhao CLA 2014-11-06 04:10:37 EST
Additional comment, org.eclipse.ui.dialogs.FilteredTree also has poor performance.
Comment 10 Eclipse Genie CLA 2019-08-29 11:17:30 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 11 Thomas Watson CLA 2019-08-29 11:55:23 EDT
JNLP is no longer supported.