"Connection refused" when syncing Maven project in 2021.1 : java.rmi.ConnectException: Connection...

解决方案

settings—》Build,Execution,Deployment—》Build Tools—》Maven—》Importing—》JDK for importer选择你安装的JDK版本


如果还是解决不了问题,可以尝试添加如下两个参数:

maven -> Importing -> VM options for importer

-Xmx768m -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Djava.net.preferIPv4Stack=true


maven -> Runner -> VM Options

-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true -Djava.net.preferIPv4Stack=true


注意:

如果已经添加了上面两个参数,还是会出现那个问题,需要移除【移除后需要Application一下】,然后重新添加

https://blog.csdn.net/qq_17555933/article/details/113735428

相关问题

Since not so long ago I often get Sync error "Cannot reconnect" when pressing a sync button after editing a pom.xml file.

I then press the sync button again and the problem disappears.

Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:

java.net.ConnectException: Connection refused: connect

at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:623) at java.rmi/sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:209) at java.rmi/sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:196) at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:132) at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:217) at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:162) at com.sun.proxy.$Proxy164.applyProfiles(Unknown Source) at jdk.internal.reflect.GeneratedMethodAccessor382.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.intellij.execution.rmi.RemoteUtil.invokeRemote(RemoteUtil.java:150)


This also seems to happen when downloading sources of a dependency (Maven project). I noticed a reboot of IntelliJ helps. But only a while, after that the same:


java.lang.RuntimeException: Cannot reconnect.

at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:82)

at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.customizeForResolve(MavenEmbedderWrapper.java:52)

at org.jetbrains.idea.maven.project.MavenProjectResolver.downloadSourcesAndJavadocs(MavenProjectResolver.java:253)

at org.jetbrains.idea.maven.project.MavenProjectsProcessorArtifactsDownloadingTask.perform(MavenProjectsProcessorArtifactsDownloadingTask.java:40)

at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java:145)

at org.jetbrains.idea.maven.project.MavenProjectsProcessor.access$000(MavenProjectsProcessor.java:36)

at org.jetbrains.idea.maven.project.MavenProjectsProcessor$1.run(MavenProjectsProcessor.java:114)

at org.jetbrains.idea.maven.utils.MavenUtil.lambda$runInBackground$5(MavenUtil.java:494)

at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)

at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)

at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:268)

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)

at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)

at java.base/java.security.AccessController.doPrivileged(Native Method)

at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)

at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:

java.net.ConnectException: Connection refused (Connection refused)

at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:623)

at java.rmi/sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:209)

at java.rmi/sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:196)

at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:132)

at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:217)

at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:162)

at com.sun.proxy.$Proxy126.createEmbedder(Unknown Source)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at com.intellij.execution.rmi.RemoteUtil.invokeRemote(RemoteUtil.java:155)

at com.intellij.execution.rmi.RemoteUtil.access$400(RemoteUtil.java:25)


(and yes, firewall is set up correctly, as i said it works for a while as well).


https://youtrack.jetbrains.com/issue/IDEA-263673

https://intellij-support.jetbrains.com/hc/en-us/articles/360014262940-Unable-to-import-Maven-project-import-fails-with-error-Cannot-reconnect

你可能感兴趣的:("Connection refused" when syncing Maven project in 2021.1 : java.rmi.ConnectException: Connection...)