Intellij Idea Maven 'cannot reconnect' error

Maybe you can help me I got a strange apache maven's problem, when opening my project at Intellij Idea 13. When projects was open I have no libraries at External Libraries section. And at all pom.xml files from diff's modules I see error "Cannot reconnect". enter image description here

I tried to Invalidate Cache/Restart Idea, try to use Maven Reimport but problem still take a place. But if I do mvn clean install, and deploy my projects everything works fine. I use Maven 3.2.3. and Java 1.8.

Maven settings: enter image description here

Aded idea.log files:

2015-06-03 11:54:24,585 [ 441715]   INFO -      #org.jetbrains.idea.maven - Cannot reconnect. 
java.lang.RuntimeException: Cannot reconnect.
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:98)
    at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.resolveProject(MavenEmbedderWrapper.java:97)
    at org.jetbrains.idea.maven.project.MavenProjectReader.resolveProject(MavenProjectReader.java:462)
    at org.jetbrains.idea.maven.project.MavenProject.resolve(MavenProject.java:624)
    at org.jetbrains.idea.maven.project.MavenProjectsTree.resolve(MavenProjectsTree.java:1215)
    at org.jetbrains.idea.maven.project.MavenProjectsProcessorResolvingTask.perform(MavenProjectsProcessorResolvingTask.java:42)
    at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java:131)
    at org.jetbrains.idea.maven.project.MavenProjectsProcessor.access$100(MavenProjectsProcessor.java:28)
    at org.jetbrains.idea.maven.project.MavenProjectsProcessor$2.run(MavenProjectsProcessor.java:107)
    at org.jetbrains.idea.maven.utils.MavenUtil$6.run(MavenUtil.java:440)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:419)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
    at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:149)
Caused by: java.rmi.ServerError: Error occurred in server thread; nested exception is: 
    java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:351)
    at sun.rmi.transport.Transport$1.run(Transport.java:200)
    at sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$254(TCPTransport.java:683)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/99407688.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
    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)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
    at com.sun.proxy.$Proxy121.resolveProject(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.execution.rmi.RemoteUtil$2$1$1.compute(RemoteUtil.java:106)
    at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:167)
    at com.intellij.execution.rmi.RemoteUtil$2$1.invoke(RemoteUtil.java:102)
    at com.sun.proxy.$Proxy121.resolveProject(Unknown Source)
    at org.jetbrains.idea.maven.server.MavenEmbedderWrapper$4.execute(MavenEmbedderWrapper.java:100)
    at org.jetbrains.idea.maven.server.MavenEmbedderWrapper$4.execute(MavenEmbedderWrapper.java:97)
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:89)
    ... 16 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
    at org.apache.maven.wagon.providers.file.FileWagon.resolveDestinationPath(FileWagon.java:206)
    at org.apache.maven.wagon.providers.file.FileWagon.resourceExists(FileWagon.java:265)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:577)
    at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
    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)
2015-06-03 11:54:24,586 [ 441716]   WARN - ution.rmi.RemoteProcessSupport - Exception in thread "pool-6-thread-1" java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils 
2015-06-03 11:54:24,586 [ 441716]   WARN - ution.rmi.RemoteProcessSupport - at org.apache.maven.wagon.providers.file.FileWagon.resolveDestinationPath(FileWagon.java:206) 

Solution 1:

I was facing the same error and fixed it like that:

  1. Open settings by pressing Ctrl+Alt+S and navigate to Build, Execution, Deployment | Build Tools | Maven | Importing

  2. Check JDK for Importer and change the exact version of JDK (example : 1.8.0.250) installed on your machine from the drop-down.

enter image description here

After doing the same it prompts for verification and after that, the maven will be automatically updated and the project will run.

In my case, I did the same thing as the JDK which is used in the machine is different when the project is imported from a repository. These things happen when we uninstall the IDE and JDK and install the IDE and different version of JDK, the IDE automatically fetch the project which is available in the machine as before but it can not change the imported JDK.

Solution 2:

I fixed this by changing my local Maven 3.3.9 to Idea Bundle Maven3.