在Eclipse中,我得到了这个错误:

run:
     [java] Error creating the server socket.
     [java] Oct 04, 2012 5:31:38 PM cascadas.ace.AceFactory bootstrap
     [java] SEVERE: Failed to create world : java.net.BindException: Address already in use: JVM_Bind
     [java] Java Result: -1
BUILD SUCCESSFUL
Total time: 10 seconds

我不知道为什么现在出现了,但几个小时前它运行得很好。我需要重新启动我的机器吗?我该怎么查到底呢?感谢您的建议和建议。


当前回答

我实际上只是在控制台选项卡中使用了终止按钮。它是一个红色的小盒子。希望这对你有所帮助。

其他回答

(1)检查端口是否被使用,杀死该进程

$ lsof:[port]

(2)另一个原因是端口被ipv6使用,解决方案:

编辑/etc/sysctl.conf

将此添加到文件中

网络上。所有ipv6。在ipv6 = 1中

然后让它生效

$ sudo sysctl -p /etc/sysctl.conf

或者重启

在Windows CMD行中,输入以下命令找出绑定端口上连接的进程ID:

C:> netstat -a -o

显示所有连接

-o show进程标识符

然后终止该过程。

对于那些正在寻找最简单的答案的人(因为这是我们通常错过的),只需停止您正在运行的项目并重新开始。 大多数情况下,我们所做的是忘记停止我们之前运行的项目,当我们重新运行项目时,它会显示这样的问题。

我还附上了一张照片,让它更清晰(我使用“Spring工具套件”)。 所以你需要做的是点击最右边的按钮,如果你想重新启动同一个项目,或者首先点击右边第二个按钮来停止你的项目,然后点击最左边的按钮来运行你的项目。我希望这将解决少数新程序员的问题。:)

I faced similar issue in Eclipse when two consoles were opened when I started the Server program first and then the Client program. I used to stop the program in the single console thinking that it had closed the server, but it had only closed the client and not the server. I found running Java processes in my Task manager. This problem was solved by closing both Server and Client programs from their individual consoles(Eclipse shows console of latest active program). So when I started the Server program again, the port was again open to be captured.

当另一个进程已经在指定端口(8080)上运行时,就会出现这个BindException异常。

您可以使用以下方法中的任何一种。

修改服务器端口号:如果使用Tomcat服务器和IntelliJ IDE,可以通过配置Tomcat服务器来配置服务器端口号

or

进入“tomcat>conf”文件夹 编辑server.xml 搜索“连接器端口” 将“8080”替换为端口号 重启tomcat服务器。

终止该端口中正在运行的现有进程并启动服务器。

对于Linux / Mac Sudo kill -9 $(Sudo lsof -t:8080) 对于Windows Netstat -ano | findstr:8080 taskkill /PID typeyourPIDhere /F 注意:(/F强制终止进程)