JonathanGiles / jonathangiles.net-comments

0 stars 0 forks source link

posts/2011/java-7-cisco-anyconnect-and-socketexceptions/index #31

Open JonathanGiles opened 4 years ago

JonathanGiles commented 4 years ago

Java 7, Cisco AnyConnect, and SocketExceptions

https://jonathangiles.net/posts/2011/java-7-cisco-anyconnect-and-socketexceptions/

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Gary Gregory Comment posted on: October 28, 2011

In order for this workaround to work, you have to restart your VPN connection.

Is this a Java 7 bug?

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Jonathan Comment posted on: October 31, 2011

My understanding (as per the <a href="http://www.java.net/node/703177&quot; rel="nofollow">discussion here</a>) is that it is a change in behavior in Java 7, and a bug in AnyConnect that it doesn't work well against IPv6. Of course, I'm not sure what the real issues are - just that this change above resolved the issue for me.

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Dan Hata Comment posted on: November 30, 2011

Holy crap, this problem has blocked me for days - thanks!

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Mia J Comment posted on: November 30, 2011

I have the same issue under win 7 x64 with jdk1.6.29. I have tried disabling ipv6 with no luck. Anyone else ever have this issue? I can run the same code with win xp w/ anyconnect and no issues.

Caused by: java.net.SocketException: Permission denied: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source)

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Daniel Comment posted on: December 2, 2011

Thanks a lot for the hint! I've run into this problem before without knowing its source. Didn't really try to get to the bottom of it since I'm only rarely using VPN.

Another possibility is to force-disable IPv6 in Java by setting the system property from the command line, like so: -Djava.net.preferIPv4Stack=true but in my case your method is much less cumbersome.

Regards