2014-10-28 245 views
0

在我的web應用程序中,我使用的是一個有簽名jar的applet,這個applet在jre 1.6和1.7之前工作正常。但是在applet的安全彈出和阻塞錯誤之後,我們不得不購買一個java代碼簽名證書。javax.net.ssl.SSLHandshakeException:遠程主機在applet握手過程中關閉連接

我已經成功簽署了此applet jar,並且此applet在HTTP協議上運行時沒有任何問題。如果我在HTTPS上打開此applet,它將開始提供SSLHandshakeException異常。我嘗試了所有可能的解決方案來運行它,但失敗了。

*Java Plug-in 11.25.2.18 
Using JRE version 1.8.0_25-b18 Java HotSpot(TM) Client VM 
User home directory = C:\Users\home 
---------------------------------------------------- 
c: clear console window 
f: finalize objects on finalization queue 
g: garbage collect 
h: display this help message 
l: dump classloader list 
m: print memory usage 
o: trigger logging 
q: hide console 
r: reload policy configuration 
s: dump system and deployment properties 
t: dump thread list 
v: dump thread stack 
x: clear classloader cache 
0-5: set trace level to <n> 
---------------------------------------------------- 
basic: Added progress listener: [email protected] 
security: Expected Main URL: https://www.example.com/test.jar 
basic: Plugin2ClassLoader.addURL parent called for https://www.example.com/test.jar 
security: Accessing keys and certificate in Mozilla user profile: null 
security: JSS is not configured 
network: Cache entry not found [url: https://www.example.com/test.jar, version: null] 
network: Connecting https://www.example.com/test.jar with proxy=DIRECT 
network: Cache entry not found [url: file:/C:/Program%20Files/Java/jre1.8.0_25/lib/ext/sunec.jar, version: null] 
network: Cache entry not found [url: file:/C:/Program%20Files/Java/jre1.8.0_25/lib/ext/sunjce_provider.jar, version: null] 
network: Connecting http://www.example.com:443/ with proxy=DIRECT 
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake 
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) 
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) 
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) 
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) 
    at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) 
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) 
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source) 
    at sun.plugin.PluginURLJarFileCallBack.connect(Unknown Source) 
    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$800(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 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.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) 
Caused by: java.io.EOFException: SSL peer shut down incorrectly 
    at sun.security.ssl.InputRecord.read(Unknown Source) 
    ... 42 more 
network: Cache entry not found [url: https://www.example.com/test.jar, version: null] 
network: Connecting https://www.example.com/test.jar with proxy=DIRECT 
network: Connecting http://www.example.com:443/ with proxy=DIRECT 
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake 
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) 
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) 
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) 
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) 
    at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) 
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) 
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source) 
    at sun.plugin.PluginURLJarFileCallBack.connect(Unknown Source) 
    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$800(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 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) 
Caused by: java.io.EOFException: SSL peer shut down incorrectly 
    at sun.security.ssl.InputRecord.read(Unknown Source) 
    ... 40 more 
network: Cache entry not found [url: https://www.example.com/Apps.class, version: null] 
network: Connecting https://www.example.com/Apps.class with proxy=DIRECT 
network: Connecting http://www.example.com:443/ with proxy=DIRECT 
network: Cache entry not found [url: https://www.example.com/Apps/class.class, version: null] 
network: Connecting https://www.example.com/Apps/class.class with proxy=DIRECT 
network: Connecting http://www.example.com:443/ with proxy=DIRECT 
java.lang.ClassNotFoundException: Apps.class 
    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) 
basic: load: class Apps.class not found. 
java.lang.ClassNotFoundException: Apps.class 
    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) 
Ignored exception: java.lang.ClassNotFoundException: Apps.class 
basic: Dialog type is not candidate for embedding 
security: Reset deny session certificate store 
basic: Removed progress listener: [email protected] 
security: Reset deny session certificate store* 

在小程序,我使用簡單的小程序

import java.applet.*; 
import java.awt.*; 

public class Apps extends Applet{ 

    public void paint(Graphics g){ 
     g.drawString("Welcome in Java Applet.",40,20); 
    } 
} 

回答

1

我們有同樣的問題。 我相信這是Java爲SSL實現TLS 1.2的一種錯誤。

根據他們的文檔https://blogs.oracle.com/java-platform-group/entry/java_8_will_use_tls,他們聲稱通過啓用TLS 1.2,它可以向後兼容舊版本。

但是,情況並非如此。當TLS 1.2被禁用時,我們不再獲得「握手期間遠程主機關閉連接」錯誤。

可以從Java控制面板的高級設置中關閉TLS 1.2支持。

一旦完成,小程序將工作。

1

在我們的案例中,我們得到了同樣的例外。但對於這兩個java1.6和1.7 我們的環境是如下:

  • jbossAS5.1與部署的Web應用程序,並在網絡 應用
  • 的Apache Web server2.2.1需要客戶端證書一個小程序(自 在客戶端Mozilla和進口客戶證書的探險家,JRE 進口客戶證書

在JRE控制面板我們DISABL簽署)

  • ed SSL2客戶端hello格式,也禁用了SSL3和TLS1.2我們只啓用了TLS1.0和TLS1.1,並且從那時起一切工作正常。

  • 相關問題