WSL2 + VPN - Connection refused when sync/reload maven
Hi Guys, I bump a thread like the https://intellij-support.jetbrains.com/hc/en-us/community/posts/6320902787602-WSL2-Connection-Refused-when-sync-maven due to a little different scenario.
I preface that this is a blocking issue which forced me to switch back (unfortunately) on Windows.
The issue is the same of the one described by the above mentioned post. Clicking on “Reload All Maven Projects” the error is:
java.util.concurrent.ExecutionException: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refusedMy environment is:
- Windows 11
- NetSkope VPN/ZTNA
- WSL 2.6.1.0 - Kernel 6.6.87.2-1
- IntelliJ Community Edition 2025.2
My WSL configuration is:
[wsl2]
kernelCommandLine=ipv6.disable=1
networkingMode=VirtIOProxy
firewall=false
dnsProxy=false
[experimental]
bestEffortDnsParsing=true
hostAddressLoopback=trueThe VirtIOProxy networking mode is mandatory in order to make NetSkope intercepting connections and go through company VPN.
As we know the VirtIOProxy forces the 127.0.0.1 to be redirected to the Windows one, making the local bound tcp listeners not reachable from WSL2 itself. For that reason WSL2 provides an additional pseudo loopback on 127.0.1.1 .
Adding the hostAddressLoopback=true experimental setting allowed me to test another scenario:
- I run a simple TCP echo server bound to localhost.
- By the above setting I was able to connect to it.
- So I tried it reloading maven projects, but I got the same error from IntelliJ.
Please, any help would be very appreciated.
Regards!
Please sign in to leave a comment.
Hi Antonio,
Please reproduce the issue and provide the following for analysis:
Files can be uploaded securely to our server at https://uploads.jetbrains.com. Make sure to share the ID of the upload here so that I can find it.
Here the information you required:
Thank you!
I wish to provide another info: IntelliJ runs inside WSL2.
Thanks Antonio.
See if it helps to add the
-Djava.net.preferIPv4Stack=trueVM option to the IDE settings (in both places) to explicitly tell Maven process to prefer the Ipv4 stack over Ipv6:1. Help | Edit Custom VM Options
2. File | Settings | Build, Execution, Deployment | Build Tools | Maven | Runner → ‘VM Options’
Sorry for my late answer.
I tried the solution you kindly provided me, but unfortunately the error is the same.
Hi Antonio - thanks for update.
One other thing to try before I submit this issue as a new bug is disabling the following option in the IDE registry:
To get to the registry:
This option is missing:
Hi Antonio, thanks for the update.
Do I understand correctly that you run the IDE inside WSL, *and* the project is also located in WSL?
Is it possible for you to try running IDEA on Windows and opening the project from there? It is the most commonly used scenario.
Another potential workaround is to copy the project to your Windows file system, and then change the corresponding Run Configuration settings to have a WSL run target.
I try to better explain.
The scenario is: