如何修复 IntelliJ 插件中的 "connection refused" 异常

How to fix the "connection refused" exception in an IntelliJ plugin

我正在从头开始为 IntelliJ(社区版 15.0.3)开发一个插件。
从一开始我就有下面的例外。

希望有人能帮助我理解为什么会收到此警告以及我应该如何解决它?

错误信息:

WARN: Connection refused: connect

java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at java.net.Socket.connect(Socket.java:528)
    at java.net.Socket.<init>(Socket.java:425)
    at java.net.Socket.<init>(Socket.java:241)
    at com.intellij.idea.SocketLock.tryActivate(SocketLock.java:184)
    at com.intellij.idea.SocketLock.access0(SocketLock.java:50)
    at com.intellij.idea.SocketLock.call(SocketLock.java:124)
    at com.intellij.idea.SocketLock.call(SocketLock.java:113)
    at com.intellij.idea.SocketLock.underLocks(SocketLock.java:157)
    at com.intellij.idea.SocketLock.lock(SocketLock.java:113)
    at com.intellij.idea.StartupUtil.lockSystemFolders(StartupUtil.java:263)
    at com.intellij.idea.StartupUtil.prepareAndStart(StartupUtil.java:101)
    at com.intellij.idea.MainImpl.start(MainImpl.java:34)
    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.ide.plugins.PluginManager.run(PluginManager.java:90)
    at java.lang.Thread.run(Thread.java:744)

MyProjectComponent.java:

import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;

public class MyProjectComponent implements ProjectComponent {

    private Project project;

    public MyProjectComponent(Project project) {
        this.project = project;
    }

    @Override
    public void projectOpened() {
        System.out.println("projectOpened");
    }

    @Override
    public void projectClosed() {
        System.out.println("projectClosed");
    }

    @Override
    public void initComponent() {
        System.out.println("initComponent");
    }

    @Override
    public void disposeComponent() {
        System.out.println("disposeComponent");
    }

    @NotNull
    @Override
    public String getComponentName() {
        return "ProjectComponent";
    }
}

此异常来自 IntelliJ 平台代码,而不是您的插件。您不能或不应该更改插件代码来修复它。