WSL2 + VPN - Connection refused when sync/reload maven

Answered

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 refused

My 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=true

The 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:

  1. I run a simple TCP echo server bound to localhost.
  2. By the above setting I was able to connect to it.
  3. So I tried it reloading maven projects, but I got the same error from IntelliJ.

Please, any help would be very appreciated.

Regards!

0
9 comments

Hi Antonio,

Please reproduce the issue and provide the following for analysis:

  1. idea.log file: Help | Show Log in…. I will search for exceptions and check your system environment settings.
  2. hosts files from both Windows and Linux machines

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.

0

Here the information you required:

Upload id: 2025_09_26_nxu1pi9WJy9BXZFwv3Rczw (file: IntelliJ-Issue-29707799559058.zip)

Thank you!

0

I wish to provide another info: IntelliJ runs inside WSL2.

0

Thanks Antonio.

See if it helps to add the -Djava.net.preferIPv4Stack=true VM 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’ 

0

Sorry for my late answer.

I tried the solution you kindly provided me, but unfortunately the error is the same.

0

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:

wsl.use.remote.agent.for.launch.processes

To get to the registry:

  1. Open Search Everywhere (Shift-Shift), type “registry” in the search bar
  2. Select the first hit from the top
  3. In the dialog that opens, start typing the name of the property to find it quickly:
0

This option is missing:

0

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.

0

I try to better explain.

The scenario is:

  • Ubuntu under WSL2.
  • IntelliJ installed by SNAP.
  • IntelliJ running by WSLg.
  • Source code under WSL2 in $HOME/projects.
0

Please sign in to leave a comment.