当IE设置有SOCKS(套接字)代理时,NetBeans Java Desktop Application也就是GUI窗口程序连接数据库总是会失败。如果关闭代理的设置,程序则能正常运行。
程序表现为:长时间处于连接状态而不返回。监视TCP连接,发现程序长时间连接到代理的IP上。
大约5分钟后,连接被断开,返回如下异常:
2012-05-05 13:16:15,984 ERROR [101001003] (WorkerThread.java:73) - com.microsoft.sqlserver.jdbc.SQLServerException: 到主机 的 TCP/IP 连接失败。 java.net.SocketException: Malformed reply from SOCKS server
这个问题肯定与IE代理有关,但System.getProperty()对"http.proxyHost"、"htttps.proxyHost"、"socksProxyHost"得到的结果都是null。
于是跟踪DriverManager.getConnection()代码到 class java.net.SocksSocketImpl 的 protected void connect(SocketAddress endpoint, int timeout) 方法中,看到如下调用:
ProxySelector.getDefault();
根据 ProxySelector.getDefault() 和 java 两个关键字google找到一篇资料:
Java Database Connectivity (JDBC) - JDBC Microsoft SQL Problem
得知问题的原因在于 NetBeans Swing Application Framework 的 org.jdesktop.application.Application.create() 调用了
System.setProperty("java.net.useSystemProxies", "true");
其中提出了两种解决办法:
public void main(String[] args) {
ProxySelector.getDefault();
// code
}
或者
@Override
protected void startup() {
invoke System.setProperty("java.net.useSystemProxies", "false");
// code
}
其它参考
Java Networking and Proxies
===========================================================================================================
Hi, I got RSEG1243 error when conecting from RDz v801 client. The host version is also 801
My another PC works fine. So I guess the host setup should be correct. Any idea for the error? Great thanks for help!
java.net.SocketException: Malformed reply from SOCKS server
java.net.SocketException: Malformed reply from SOCKS server
at java.net.SocksSocketImpl.readSocksReply(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.eclipse.dstore.core.client.ClientConnection.connectDaemon(Unknown Source)
at com.ibm.etools.zseries.util.DStoreWithSSHConnectorService.launchServer(Unknown Source)
at com.ibm.etools.zseries.util.DStoreWithSSHConnectorService.launchServer(Unknown Source)
at org.eclipse.rse.connectorservice.dstore.DStoreConnectorService.connectWithDaemon(Unknown Source)
at org.eclipse.rse.connectorservice.dstore.DStoreConnectorService.internalConnect(Unknown Source)
at org.eclipse.rse.core.subsystems.AbstractConnectorService$1.run(Unknown Source)
at org.eclipse.rse.core.subsystems.AbstractConnectorService$SafeRunner.run(Unknown Source)
at org.eclipse.rse.core.subsystems.AbstractConnectorService.connect(Unknown Source)
at org.eclipse.rse.core.subsystems.SubSystem.connect(Unknown Source)
at org.eclipse.rse.internal.ui.actions.SystemConnectAllSubSystemsAction$ConnectAllJob.run(Unknown Source)
at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)
A suggestion given by our server side expert...
Can you check to see if the PC w/ the connectivity issue have the same SOCKS server and the same JDK level as the other one that can connect?
Steven
-------------------
Hi, Thanks for the idea, this is exactly the problem!
We found the "SOCKS" box is checked in the Perference --> Network Connection. And this setting is imported from client PC's IE setup automatically.
We change the IE setup to uncheck the SOCKS option and it works now.
Also we found in RDz v7.1 it won't import IE setup automatically, so the problem is not exist in v7.1 client.
分享到:
相关推荐
java.net.SocketException: Unrecognized Windows Sockets error: 0: no Inet4Address associated with interface 本文提供了在Win7或Vista系统下解决这个异常信息的办法。
java.net.SocketException Connection reset 解决方法
JAVA.NET.SOCKETEXCEPTION TOO MANY OPEN FILES解决方法,三种方案,临时,永久,根治
NULL 博文链接:https://zhoudan241.iteye.com/blog/1432014
最近纠结致死的一个java报错java.net.SocketException: Connection reset 终于得到解决
接口调用报错:java.net.SocketException: java.lang.ClassNotFoundException: Cannot find the specified class com.ibm.websphere.ssl.protocol.SSLSocketFactory
System.Net.WebException: 无法显示错误消息,原因是无法找到包含此错误消息的可选资源程序集 ---> System.Net.Sockets.SocketException: 无法显示错误消息,原因是无法找到包含此错误消息的可选资源程序集 ...
Google I/O 2013推荐Android 网络通信框架Volley 下载下来后然后编译为jar包,再在自己的工程里import进来。
FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站...
socket 文件同步
import java.net.SocketException; public class UDPServer { public static void main(String[] args) { try { byte [] buffer = new byte[1024]; DatagramSocket socket = new DatagramSocket(4444); ...
Linux下运行tomcat或者was出现java.net.SocketException: 打开的文件过多错误 tomcat报“too many open files”的错误,解决办法如下:
34. import java.net.SocketException; 35. import java.net.UnknownHostException; 36. import java.util.Date; 37. import java.util.Scanner; 38. import java.util.Stack; 39. import java.util.prefs....
System.Net.Sockets.SocketException: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 想到阿里云喜欢用安全组屏蔽端口,于是我就赶紧去配置了安全规则。进站出站都配置了,结果还是...
转:java.net.SocketException: Too many open files解决方法最近随着网站访问量的提高把web服务器移到linux下了,在移服务器的第二天,tomcat频繁的报 java.net.SocketException: Too many open files错误,错误...
syslog4j Syslog4j提供了BSD Syslog协议(RFC 3164)和“结构化syslog”协议草案(RFC Draft)的客户端和服务器实现。 警告 这是使用的重新打包的fork,因为原始软件包没有发布到Maven Central的最新版本。...
1.解决服务器报错:java.net.SocketException: No buffer space available (maximum connections reached?): JVM_Bind 2.解决Windows Server 2003/2008 R2系统BUG导致windows缓冲区已满(no buffer space),Windows...
注意:由于压缩包大于15M,所以分两部分上传,这是第一部分!下载SSH2-1后,再解压这两个文件后就可用了。
有时会抛出 java.net.SocketException: Invalid argument) Java 行家 运行upload.rb 配置 将 aws 凭据设置为 AwsCredentials.properties 具有标记列和别名列的 csv 文件。 令牌列应命名为“device_token”或...
./server: Network.cpp:475:Ice::SocketException: socket exception: Address already in use ///stringtoProxy对于任何string都是有效的,均可以生成相应代理,但是该代理是否有效是无法保证的. 如果代理无效,...