JDK-7184280 : Applets from a local http server don't load with Windows 7 64 bits and JRE 1.7
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-07-16
  • Updated: 2012-08-03
  • Resolved: 2012-07-30
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
All JRE 1.7 (from JRE 1.7.0_01 to JRE 1.7.0_05)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [version 6.1.7600]
Windows 7 64 bits


EXTRA RELEVANT SYSTEM CONFIGURATION :
All JRE 1.7 (from JRE 1.7.0_01 to JRE 1.7.0_05)
  Tomcat 6.0.32 (I also tried with Apache and Glassfish)
Local network


A DESCRIPTION OF THE PROBLEM :
In Windows 7 64 bits, with a JRE 1.7, from any browser (Firefox, Internet Explorer 9 at 32 and at 64 bit, Chrome), when we try to run an applet hosted on an http server on a local network,
 the download of jars starts, but never ends. Via the internet it downloads but not via a local network.
For exemple, we tried the applet at "http://java.com/en/download/testjava.jsp", it works. But when we put this applet (TestVM2-test.jar) on a Tomcat under a local network, the applet doesn't load.

I spent some time on this issue and found the following :
The problem is the communication with IPv6 : if we add the parameter "-Djava.net.preferIPv4Stack=true" to the JRE, the applets do load.
I think that in Windows 7 64 bits :
 - with JRE 1.6, the communication is in IPv4,
 - with JRE 1.7, via the internet, the communication is in IPv4,
 - but with JRE 1.7, in a local network the communication is in IPv6 and there is a problem in the java code of the JRE which makes that in this case the applets don't load.
I searched in the java code of rt.jar and found the following :
In the class java.net.PlainSocketImpl, the parameter preferIPv4Stack is read and if it is true, we use a java.net.TwoStacksPlainSocketImpl object,
 but if it is false we use a java.net.DualStackPlainSocketImpl that handles both IPv4 and IPV6 through a single file descriptor.
May be the problem is here ?

REGRESSION.  Last worked in version 6u31

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Windows 7 64 bits, JRE 1.7.x
Take any applet (for exemple the applet that is on http://java.com/en/download/testjava.jsp) and put it on a Tomcat or Apache on your machine with an html page to acces it.
Open IE 9 and acces the html page (exemple http://localhost/TestJava/), your applet won't load.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The applet should load and display in IE.
ACTUAL -
The applet does not load.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Here is the trace in the java console :

Plug-in Java 10.4.0.22
Utilisation de la version JRE 1.7.0_04-b22 Java HotSpot(TM) Client VM
R��pertoire d'origine de l'utilisateur = C:\Users\mounir
----------------------------------------------------
c:   effacer la fen��tre de la console
f:   finaliser les objets de la file d'attente de finalisation
g:   nettoyer la m��moire
h:   afficher ce message d'aide
l:   vider la liste des chargeurs de classes
m:   imprimer le relev�� d'utilisation de la m��moire
o:   d��clencher la journalisation
q:   masquer la console
r:   recharger la configuration des r��gles
s:   vider les propri��t��s syst��me et de d��ploiement
t:   vider la liste des threads
v:   vider la pile des threads
x:   effacer le cache de chargeurs de classes
0-5: fixer le niveau de trace �� <n>
----------------------------------------------------
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition value null
security: property package.definition new value com.sun.javaws
security: property package.definition value com.sun.javaws
security: property package.definition new value com.sun.javaws,com.sun.deploy
security: property package.definition value com.sun.javaws,com.sun.deploy
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
security: property package.definition value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
preloader: Construct preloader delegate
preloader: Setting default preloader and progress monitor for non JNLP applets
basic: Processus d'��coute de progression ajout�� : sun.plugin.util.ProgressMonitorAdapter@1176e5c
preloader: Installing progress monitor true
preloader: Using preloader class: null com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter@1a1472d
preloader: Using default preloader
preloader: Requested to use preloader class: null
basic: Plugin2ClassLoader.addURL parent called for http://192.168.0.185/TestJava/applet/TestVM2-test.jar
preloader: Skipped all (0) download events prior to null
preloader: GrayBox: parent = sun.plugin2.main.client.PluginEmbeddedFrame[frame0,0,0,500x335,layout=java.awt.BorderLayout,title=,resizable,normal]
preloader: Delivering: AppletInitEvent[type=CallConstructor]
preloader: Start progressCheck thread
network: Entr��e de cache introuvable [URL��: http://192.168.0.185/TestJava/applet/TestVM2-test.jar, version��: null]
network: Connexion de http://192.168.0.185/TestJava/applet/TestVM2-test.jar avec proxy=DIRECT
network: Connexion de http://192.168.0.185:80/ avec proxy=DIRECT
preloader: Stop progressCheck thread

And after a while :
java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(Unknown Source)
	at java.net.SocketInputStream.read(Unknown Source)
	at java.io.BufferedInputStream.fill(Unknown Source)
	at java.io.BufferedInputStream.read1(Unknown Source)
	at java.io.BufferedInputStream.read(Unknown Source)
	at sun.net.www.MeteredStream.read(Unknown Source)
	at java.io.FilterInputStream.read(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.close(Unknown Source)
	at java.io.BufferedInputStream.close(Unknown Source)
	at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
	at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
	at sun.plugin.PluginURLJarFileCallBack$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)
	at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
	at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
	at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
	at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
	at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
	at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(Unknown Source)
	at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$1000(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
network: Entr��e de cache introuvable [URL��: http://localhost/TestJava/applet/TestVM2-test.jar, version��: null]
network: Connexion de http://localhost/TestJava/applet/TestVM2-test.jar avec proxy=DIRECT
network: Connexion de http://localhost:80/ avec proxy=DIRECT

Then a message box with an exception :
java.lang.ClassNotFoundException: testJava2_1.TestVMApplet
	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

I made a full thread dump and here is where the applet download blocks :

"thread applet-testJava2_1/TestVMApplet-1" prio=4 tid=0x06810800 nid=0x19f8 runnable [0x0805d000]
   java.lang.Thread.State: RUNNABLE
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(Unknown Source)
	at java.net.SocketInputStream.read(Unknown Source)
	at java.io.BufferedInputStream.read1(Unknown Source)
	at java.io.BufferedInputStream.read(Unknown Source)
	- locked <0x29b8dd60> (a java.io.BufferedInputStream)
	at sun.net.www.MeteredStream.read(Unknown Source)
	- locked <0x29b8dd80> (a sun.net.www.http.KeepAliveStream)
	at java.io.FilterInputStream.read(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source)
	at java.io.BufferedInputStream.read1(Unknown Source)
	at java.io.BufferedInputStream.read(Unknown Source)
	- locked <0x29b8dde0> (a java.io.BufferedInputStream)
	at java.io.FilterInputStream.read(Unknown Source)
	at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
	at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
	at sun.plugin.PluginURLJarFileCallBack$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)
	at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
	at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
	at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
	at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
	at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
	at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(Unknown Source)
	- locked <0x29b8df48> (a sun.plugin.net.protocol.jar.CachedJarURLConnection)
	at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
	- locked <0x29b8df48> (a sun.plugin.net.protocol.jar.CachedJarURLConnection)
	at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$1000(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
	at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
	- locked <0x29a35830> (a com.sun.deploy.security.DeployURLClassPath)
	at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
	- locked <0x29a35870> (a sun.plugin2.applet.Applet2ClassLoader)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
	- locked <0x29a35910> (a sun.plugin2.applet.Applet2ClassLoader)
	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
	- locked <0x29a35910> (a sun.plugin2.applet.Applet2ClassLoader)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
If we add the parameter "-Djava.net.preferIPv4Stack=true" to the JRE, the applets do load.