Maven下载源码报错(MAC)–Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1;

记录一下debug源码时遇到的Maven异常问题,供自己以后检索。

详细报错信息
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:38)
at org.jetbrains.idea.maven.project.MavenProjectResolver.downloadSourcesAndJavadocs(MavenProjectResolver.java:256)
at org.jetbrains.idea.maven.project.MavenProjectsProcessorArtifactsDownloadingTask.perform(MavenProjectsProcessorArtifactsDownloadingTask.java:40)
at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java:146)
at org.jetbrains.idea.maven.project.MavenProjectsProcessor 1. r u n ( M a v e n P r o j e c t s P r o c e s s o r . j a v a : 115 ) a t o r g . j e t b r a i n s . i d e a . m a v e n . u t i l s . M a v e n U t i l . l a m b d a 1.run(MavenProjectsProcessor.java:115) at org.jetbrains.idea.maven.utils.MavenUtil.lambda 1.run(MavenProjectsProcessor.java:115)atorg.jetbrains.idea.maven.utils.MavenUtil.lambdarunInBackground$5(MavenUtil.java:524)
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. c a l l ( A p p l i c a t i o n I m p l . j a v a : 270 ) a t j a v a . b a s e / j a v a . u t i l . c o n c u r r e n t . F u t u r e T a s k . r u n ( F u t u r e T a s k . j a v a : 264 ) a t j a v a . b a s e / j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r . r u n W o r k e r ( T h r e a d P o o l E x e c u t o r . j a v a : 1128 ) a t j a v a . b a s e / j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r 1.call(ApplicationImpl.java:270) 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 1.call(ApplicationImpl.java:270)atjava.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)atjava.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)atjava.base/java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1 1. r u n ( E x e c u t o r s . j a v a : 668 ) a t j a v a . b a s e / j a v a . u t i l . c o n c u r r e n t . E x e c u t o r s 1.run(Executors.java:668) at java.base/java.util.concurrent.Executors 1.run(Executors.java:668)atjava.base/java.util.concurrent.ExecutorsPrivilegedThreadFactory$1 1. r u n ( E x e c u t o r s . j a v a : 665 ) a t j a v a . b a s e / j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t j a v a . b a s e / j a v a . u t i l . c o n c u r r e n t . E x e c u t o r s 1.run(Executors.java:665) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.util.concurrent.Executors 1.run(Executors.java:665)atjava.base/java.security.AccessController.doPrivileged(NativeMethod)atjava.base/java.util.concurrent.ExecutorsPrivilegedThreadFactory 1. r u n ( E x e c u t o r s . j a v a : 665 ) a t j a v a . b a s e / j a v a . l a n g . T h r e a d . r u n ( T h r e a d . j a v a : 834 ) C a u s e d b y : j a v a . r m i . C o n n e c t E x c e p t i o n : C o n n e c t i o n r e f u s e d t o h o s t : 127.0.0.1 ; n e s t e d e x c e p t i o n i s : j a v a . n e t . C o n n e c t E x c e p t i o n : C o n n e c t i o n r e f u s e d ( C o n n e c t i o n r e f u s e d ) a t j a v a . r m i / s u n . r m i . t r a n s p o r t . t c p . T C P E n d p o i n t . n e w S o c k e t ( T C P E n d p o i n t . j a v a : 623 ) a t j a v a . r m i / s u n . r m i . t r a n s p o r t . t c p . T C P C h a n n e l . c r e a t e C o n n e c t i o n ( T C P C h a n n e l . j a v a : 209 ) a t j a v a . r m i / s u n . r m i . t r a n s p o r t . t c p . T C P C h a n n e l . n e w C o n n e c t i o n ( T C P C h a n n e l . j a v a : 196 ) a t j a v a . r m i / s u n . r m i . s e r v e r . U n i c a s t R e f . i n v o k e ( U n i c a s t R e f . j a v a : 132 ) a t j a v a . r m i / j a v a . r m i . s e r v e r . R e m o t e O b j e c t I n v o c a t i o n H a n d l e r . i n v o k e R e m o t e M e t h o d ( R e m o t e O b j e c t I n v o c a t i o n H a n d l e r . j a v a : 217 ) a t j a v a . r m i / j a v a . r m i . s e r v e r . R e m o t e O b j e c t I n v o c a t i o n H a n d l e r . i n v o k e ( R e m o t e O b j e c t I n v o c a t i o n H a n d l e r . j a v a : 162 ) a t c o m . s u n . p r o x y . 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. 1.run(Executors.java:665)atjava.base/java.lang.Thread.run(Thread.java:834)Causedby:java.rmi.ConnectException:Connectionrefusedtohost:127.0.0.1;nestedexceptionis:java.net.ConnectException:Connectionrefused(Connectionrefused)atjava.rmi/sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:623)atjava.rmi/sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:209)atjava.rmi/sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:196)atjava.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:132)atjava.rmi/java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:217)atjava.rmi/java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:162)atcom.sun.proxy.Proxy157.createEmbedder(Unknown Source)
at jdk.internal.reflect.GeneratedMethodAccessor3835.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)
at com.intellij.execution.rmi.RemoteUtil.access$400(RemoteUtil.java:21)
at com.intellij.execution.rmi.RemoteUtil 1. l a m b d a 1.lambda 1.lambdainvoke$0(RemoteUtil.java:134)
at com.intellij.openapi.util.ClassLoaderUtil.computeWithClassLoader(ClassLoaderUtil.java:31)
at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:202)
at com.intellij.execution.rmi.RemoteUtil 1. i n v o k e ( R e m o t e U t i l . j a v a : 134 ) a t c o m . s u n . p r o x y . 1.invoke(RemoteUtil.java:134) at com.sun.proxy. 1.invoke(RemoteUtil.java:134)atcom.sun.proxy.Proxy157.createEmbedder(Unknown Source)
at org.jetbrains.idea.maven.server.MavenServerConnectorImpl.createEmbedder(MavenServerConnectorImpl.java:192)
at org.jetbrains.idea.maven.server.MavenServerManager$3.create(MavenServerManager.java:371)
at org.jetbrains.idea.maven.server.MavenServerManager 3. c r e a t e ( M a v e n S e r v e r M a n a g e r . j a v a : 359 ) a t o r g . j e t b r a i n s . i d e a . m a v e n . s e r v e r . R e m o t e O b j e c t W r a p p e r . g e t O r C r e a t e W r a p p e e ( R e m o t e O b j e c t W r a p p e r . j a v a : 41 ) a t o r g . j e t b r a i n s . i d e a . m a v e n . s e r v e r . M a v e n E m b e d d e r W r a p p e r . d o C u s t o m i z e ( M a v e n E m b e d d e r W r a p p e r . j a v a : 79 ) a t o r g . j e t b r a i n s . i d e a . m a v e n . s e r v e r . M a v e n E m b e d d e r W r a p p e r . l a m b d a 3.create(MavenServerManager.java:359) at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:41) at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.doCustomize(MavenEmbedderWrapper.java:79) at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.lambda 3.create(MavenServerManager.java:359)atorg.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:41)atorg.jetbrains.idea.maven.server.MavenEmbedderWrapper.doCustomize(MavenEmbedderWrapper.java:79)atorg.jetbrains.idea.maven.server.MavenEmbedderWrapper.lambdacustomizeForResolve$0(MavenEmbedderWrapper.java:39)
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)
… 17 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/java.net.Socket.connect(Socket.java:558)
at java.base/java.net.Socket.(Socket.java:454)
at java.base/java.net.Socket.(Socket.java:231)
at com.intellij.execution.rmi.RemoteServer$1.createSocket(RemoteServer.java:122)
at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:617)
… 40 more
解决方案
IntelliJ IDEA --> Preferences --> Build,Execution,Deployment --> Build Tools --> Maven --> Importing -->JDK for importer选择我们已经安装的JDK版本

在这里插入图片描述
如果还是解决不了问题,可以尝试添加如下两个参数:
1)maven -> Importing -> VM options for importer

-Xmx768m -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Djava.net.preferIPv4Stack=true
2)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

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐