Java 7, Cisco AnyConnect, and SocketExceptions

This post is probably irrelevant to most readers, but I'm putting it online in the hope it saves someone hours of hair-pulling...

I've been holding off upgrading to Java 7 as every time I tried, I'd run into annoying issues preventing me from working. In particular, I was running into the issues discussed here. I thought I'd try again today with Java 7u1, but unfortunately immediately had the same issue. As in the previous link, my situation is that I need to use Cisco AnyConnect VPN client to connect to VPNs, and when I was attempting to pull down a remote file, I was getting the following exception:

ERROR:java.net.SocketException: Permission denied: connect
java.net.SocketException: Permission denied: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:316)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:177)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:164)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:154)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:390)
at java.net.Socket.connect(Socket.java:578)
at java.net.Socket.connect(Socket.java:527)
at java.net.Socket.(Socket.java:424)
at java.net.Socket.(Socket.java:279)

After spending many hours working through suggestions made on Google, I finally discovered the fix. It turns out that by disabling IPv6 in the VPN properties in Windows, the issue goes away. Here is the screenshot of how my properties dialog looks in Windows after making the change:

I hope this helps!

Thoughts on “Java 7, Cisco AnyConnect, and SocketExceptions”