JDK-8161986 : Selecting 32/64 bit resources failed if user has installed both jre's
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 8u102,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2016-07-20
  • Updated: 2017-11-29
  • Resolved: 2016-08-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u111Fixed 9Fixed
Related Reports
Relates :  
Relates :  
Sub Tasks
JDK-8172427 :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

AND

java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) Client VM (build 25.102-b14, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

EXTRA RELEVANT SYSTEM CONFIGURATION :
C:\Program Files\Java\jre1.8.0_102 (8u102 64bit) 
AND
C:\Program Files (x86)\Java\jre1.8.0_102 (8u102 32bit)
installed

A DESCRIPTION OF THE PROBLEM :
Running applications with 32/64 bit dependend code is broken in java 8u102 when you have installed both (32 and 64 bit) runtimes.
I think this bugfixes broke it:
- https://bugs.openjdk.java.net/browse/JDK-8055448
- https://bugs.openjdk.java.net/browse/JDK-8003984

We have a swt application which need special jar for every platform and arch. This is a simplified version of our jnlp:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://ghlx02.guh-local.de/jws/protilo" href="protilo.jnlp">
	<information>
		...
	</information>
	<security>
		<all-permissions/>
	</security> 
	
	<resources>
		<java version="1.8+"/>
		<jar href="protilo.jar" />
	</resources>
	<resources os="Windows" arch="x86">
    	<jar href="win32/swt.jar"/>
	</resources>
	<resources os="Windows" arch="amd64">
    	<jar href="win64/swt.jar"/>
	</resources>
	<resources os="Linux" arch="i386">
    	<jar href="linux32/swt.jar"/>
	</resources>
	<resources os="Linux" arch="amd64">
    	<jar href="linux64/swt.jar"/>
	</resources>
	
	<application-desc main-class="de.guhsoft.protilo.Main"/>
</jnlp>

It seems that java 8u102 does not filter for arch in resources (descripted here: https://bugs.openjdk.java.net/browse/JDK-8055448?focusedCommentId=13823297&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13823297). 

If i look into the java viewer (of both jres) and display the jnlp file (right click on application, "show jnlp file") is se the following:

>     ...
>     <jar href="http://ghlx02.guh-local.de/jws/protilo/win32/swt.jar" download="eager" main="false"/>
>     <jar href="http://ghlx02.guh-local.de/jws/protilo/win64/swt.jar" download="eager" main="false"/>
>     ...

(which is wrong, it should the 32bit one for 32bit jre and the 64bit one for 64bit jre)

If i do that on the previous releases (alos 32 and 64 bit vm installed), this is shown:

32bit JRE:
>     ...
>     <jar href="http://ghlx02.guh-local.de/jws/protilo/win32/swt.jar" download="eager" main="false"/>
>     ...

64bit JRE:
>     ...
>     <jar href="http://ghlx02.guh-local.de/jws/protilo/win64/swt.jar" download="eager" main="false"/>
>     ...

When i run this, it fails:

> "C:\Program Files (x86)\Java\jre1.8.0_102\bin\javaws.exe" http://ghlx02.guh-local.de/jws/protilo/protilo.jnlp

When i run this, it works:

> "C:\Program Files\Java\jre1.8.0_102\bin\javaws.exe" http://ghlx02.guh-local.de/jws/protilo/protilo.jnlp

This is the exception we get (it loads the wrong library):

java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on
64-bit JVM
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
    at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
    at de.guhsoft.protilo.Main.<init>(Main.java:66)
    at de.guhsoft.protilo.Main.main(Main.java:59)
    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) 

REGRESSION.  Last worked in version 8u92

ADDITIONAL REGRESSION INFORMATION: 
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

AND

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) Client VM (build 25.92-b14, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use a jnlp with 32 and 64 bit resources like this:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://ghlx02.guh-local.de/jws/protilo" href="protilo.jnlp">
	<information>
		...
	</information>
	<security>
		<all-permissions/>
	</security> 
	
	<resources>
		<java version="1.8+"/>
		<jar href="protilo.jar" />
	</resources>
	<resources os="Windows" arch="x86">
    	<jar href="win32/swt.jar"/>
	</resources>
	<resources os="Windows" arch="amd64">
    	<jar href="win64/swt.jar"/>
	</resources>
	<resources os="Linux" arch="i386">
    	<jar href="linux32/swt.jar"/>
	</resources>
	<resources os="Linux" arch="amd64">
    	<jar href="linux64/swt.jar"/>
	</resources>
	
	<application-desc main-class="de.guhsoft.protilo.Main"/>
</jnlp>

Install both 32 and 64 bit java 8u102 jres/jdks

Run

> "C:\Program Files (x86)\Java\jre1.8.0_102\bin\javaws.exe" http://ghlx02.guh-local.de/jws/protilo/protilo.jnlp

and

> "C:\Program Files\Java\jre1.8.0_102\bin\javaws.exe" http://ghlx02.guh-local.de/jws/protilo/protilo.jnlp

first will fail, second works.

if you change the resource order in your jnlp, the opposite will happen...

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
both should work
ACTUAL -
exception cause wrong library will be loaded

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on
64-bit JVM
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
    at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
    at de.guhsoft.protilo.Main.<init>(Main.java:66)
    at de.guhsoft.protilo.Main.main(Main.java:59)
    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) 

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
no workaround found

SUPPORT :
YES


Comments
No any issues related to the fix have been detected in the recent 8u-dev Deployment nightly. UR SQE OK to take it in CPU16_04.
18-08-2016

This has CPU16_04 critical watch - I have fixed in JDK9 - but is up to support team to decide where to port to 8u
16-08-2016

Issue discussed in stackoverflow - http://stackoverflow.com/questions/38629737/starting-a-jnlp-application-with-an-existing-installation-of-jre-x86-and-x64/38632217#38632217 Work around suggested by other users.
28-07-2016

Checked this on Windows 7 (64-bit) system for versions 8u101 and 8u102 (with both 32-bit and 64-bit) installed. This is a regression with issues being reproducible with version 8u102. 8u101 b13: OK 8u102 b13: FAIL 8u102 b14: FAIL Note: Both 32-bit and 64-bit need to be installed on the system ---------------------------------------------------------------------------------------- Reproducible case: To reproduce, run the following jnlp: http://www.guh-software.de/javaBugs/9095987/demo.jnlp Output ================================== 8u102 b14 (32-bit) Both 32-bit and 64-bit installed and run with 32-bit JWS: ============================================================== Java Web Start 11.102.2.14 amd64 Using JRE version 1.8.0_102-b14 Java HotSpot(TM) 64-Bit Server VM User home directory = C:\Users\dcsuser ---------------------------------------------------- c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message m: print memory usage o: trigger logging p: reload proxy configuration q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack 0-5: set trace level to <n> ---------------------------------------------------- #### Java Web Start Error: #### java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM ======================================================================================== 8u102 b14 (64-bit) Both 32-bit and 64-bit installed and run with 64-bit JWS: ========================================================== Java Web Start 11.102.2.14 x86 Using JRE version 1.8.0_102-b14 Java HotSpot(TM) Client VM User home directory = C:\Users\dcsuser ---------------------------------------------------- c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message m: print memory usage o: trigger logging p: reload proxy configuration q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack 0-5: set trace level to <n> ---------------------------------------------------- JNLPClassLoader: Finding library swt-win32-4517.dll JNLPClassLoader: Finding library swt-win32.dll JNLPClassLoader: Finding library swt-win32-4517.dll JNLPClassLoader: Finding library swt-win32.dll Trace level set to 2: basic, net ... completed.
21-07-2016