IDEA Unable to import maven project 解決方法
最近在用maven無論是新建專案還是匯入沒有下載到本地倉庫的jar。出現了Unable to import maven project
該錯誤。而且每次idea要卡頓很長時間。大概3-5分鐘吧。由於本人的本本是mac ,系統用了兩年多了,雖然中間有一些更新包打了。但一直都比較穩定。而且由於之前要測試網路,結果把localhost指向了192.168.0.101 結果悲劇就出現了。後來查看了日誌,發現了有
2017-04-13 23:31:18,792 [2109473] ERROR - #org.jetbrains.idea.maven - Cannot reconnect.
java.lang.RuntimeException: Cannot reconnect.
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:82)
at org.jetbrains.idea.maven.server.MavenServerManager.applyProfiles(MavenServerManager.java:555)
at org.jetbrains.idea.maven.project.MavenProjectReader.applyProfiles(MavenProjectReader.java:397)
at org.jetbrains.idea.maven.project.MavenProjectReader.doReadProjectModel(MavenProjectReader.java:103)
at org.jetbrains.idea.maven.project.MavenProjectReader.readProject(MavenProjectReader.java:62)
at org.jetbrains.idea.maven.project.MavenProject.read(MavenProject.java:631)
at org.jetbrains.idea.maven.project.MavenProjectsTree.doUpdate(MavenProjectsTree.java:560)
at org.jetbrains.idea.maven.project.MavenProjectsTree.doAdd(MavenProjectsTree.java:505)
at org.jetbrains.idea.maven.project.MavenProjectsTree.update(MavenProjectsTree.java:466)
at org.jetbrains.idea.maven.project.MavenProjectsTree.update(MavenProjectsTree.java:448)
at org.jetbrains.idea.maven.project.MavenProjectsProcessorReadingTask.perform(MavenProjectsProcessorReadingTask.java:64)
at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java:130)
at org.jetbrains.idea.maven.project.MavenProjectsProcessor.access$000(MavenProjectsProcessor.java:30)
at org.jetbrains.idea.maven.project.MavenProjectsProcessor$2.run(MavenProjectsProcessor.java:105)
at org.jetbrains.idea.maven.utils.MavenUtil.lambda$runInBackground$5(MavenUtil.java:458)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:309)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.rmi.RemoteException: Cannot start maven service; nested exception is:
java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Operation timed out
at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:173)
at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:78)
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:41)
at org.jetbrains.idea.maven.server.MavenServerManager$7.execute(MavenServerManager.java:558)
at org.jetbrains.idea.maven.server.MavenServerManager$7.execute(MavenServerManager.java:555)
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)
... 20 more
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Operation timed out
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at com.intellij.execution.rmi.RemoteProcessSupport.a(RemoteProcessSupport.java:258)
at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:226)
at com.intellij.execution.rmi.RemoteProcessSupport.b(RemoteProcessSupport.java:256)
at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:162)
at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:170)
... 25 more
Caused by: java.net.ConnectException: Operation timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:211)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 34 more
類似的異常資訊,就去ping localhost 結果發現指向的是192.168.0.101,看了我自己的IP,發現根本就不在一個網段。。因為一個IP的問題折騰了好久。。哎,還得多看日誌,多看日誌,多看日誌。。引以為戒