地址已在使用:JVM_Bind java
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2772701/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Address already in use: JVM_Bind java
提问by gmhk
Some times whenever I restart the application, which is built on Java Struts Mysql and Jboss 4.05 Version I get the error as Address already in use: JVM_Bind
有时每当我重新启动基于 Java Struts Mysql 和 Jboss 4.05 版本的应用程序时,我都会收到错误,地址已在使用中:JVM_Bind
Only fix that i know is to restart the machine and try again, it will work. Else Some times I do Ctrl-Alt-Del and Stop all the process related to Java, some times this also works.
我知道的唯一解决方法是重新启动机器并重试,它会起作用。其他有时我会执行 Ctrl-Alt-Del 并停止所有与 Java 相关的进程,有时这也有效。
But what is the exact reason and how can we prevent this problem ?
但确切的原因是什么,我们如何防止这个问题?
采纳答案by phoenix24
Address already in use: JVM_Bind
已使用地址:JVM_Bind
means that some other application is already listening on the port your current application is trying to bind.
意味着某些其他应用程序已经在侦听您当前应用程序试图绑定的端口。
what you need to do is, either change the port for your current application or better; just find out the already running application and kill it.
您需要做的是,更改当前应用程序的端口或更好;只需找出已经运行的应用程序并杀死它。
on Linux you can find the application pid by using,
在 Linux 上,您可以使用以下命令找到应用程序 pid,
netstat -tulpn
回答by Jarle Hansen
The quick answer on how to prevent it is that you most likely need to stop JBoss before starting it again.
关于如何防止它的快速答案是您很可能需要在再次启动 JBoss 之前停止它。
You should be able to call the "Terminate" button in the Console view to shutdown the server.
您应该能够在控制台视图中调用“终止”按钮来关闭服务器。
回答by JoseK
Is it possible that MySql listening on the same port as JBoss?
MySql 是否有可能在与 JBoss 相同的端口上监听?
Is there a port number given in the error message - something like Address already in use: JVM_Bind:8080
错误消息中是否给出了端口号 - 类似于 Address already in use: JVM_Bind:8080
You can change the port in JBoss server.xml to test this.
您可以更改 JBoss server.xml 中的端口来测试它。
回答by Martijn Courteaux
That error means that the you are trying to create a new ServerSocket
on a port already in use by another ServerSocket
. So try to make your application closing all sockets and connections you know about and be sure your application is completely terminated. Also check if there is another proces you launched by your program.
该错误意味着您正试图ServerSocket
在已被另一个ServerSocket
. 所以尽量让你的应用程序关闭所有你知道的套接字和连接,并确保你的应用程序完全终止。还要检查您的程序是否启动了其他进程。
回答by frictionlesspulley
I usually come across this when the port which the server (I use JBoss) is already in use
当服务器(我使用 JBoss)的端口已经在使用时,我通常会遇到这个
Usual suspects
普通嫌犯
- Apache Http Server => turn down the service if working in windows.
- IIS => stop the ISS using
- Skype =>yea I got skype attaching itself to port 80
- Apache Http Server => 如果在 Windows 中工作,请关闭该服务。
- IIS => 停止 ISS 使用
- Skype => 是的,我将 Skype 连接到端口 80
To change the port to which JBoss 4.2.x binds itself go to:
要更改 JBoss 4.2.x 绑定的端口,请转到:
"C:\jboss4.2.2\server\default\deploy\jboss-web.deployer\server.xml"
"C:\jboss4.2.2\server\default\deploy\jboss-web.deployer\server.xml"
here default is the instance of the server change the port here :
这里默认是服务器的实例在这里更改端口:
<Connector port="8080" address="${jboss.bind.address}" >
<连接器端口=“8080”地址=“${jboss.bind.address}”>
In the above example the port is bound to 8080
在上面的例子中,端口绑定到 8080
回答by aarifmkhan
please try following options for JVM binding exception:
请尝试以下 JVM 绑定异常选项:
- start and stop the server. and check the server process ids and kill and stop the server.
- go to control panel->administrative tool-> service-> check all server and stop all the servers and then start your own server.
- change the Browser which your using. for example if your using IE ,change it to Mozilla firefox.
- 启动和停止服务器。并检查服务器进程 ID 并杀死并停止服务器。
- 转到控制面板-> 管理工具-> 服务-> 检查所有服务器并停止所有服务器,然后启动您自己的服务器。
- 更改您使用的浏览器。例如,如果您使用 IE,请将其更改为 Mozilla firefox。
回答by busycoding
I was having this problem too. For me, I couldn't start/stop openfire (it said it was stopped, but everything was still running)
我也遇到了这个问题。对我来说,我无法启动/停止 openfire(它说它已停止,但一切仍在运行)
sudo /etc/init.d/openfire stop
sudo /etc/init.d/openfire start
Also, restarting apache did not help either
此外,重新启动 apache 也没有帮助
sudo /etc/init.d/apache2 restart
The errors were inside:
错误在里面:
/opt/openfire/logs/stderror.log
Error creating server listener on port 5269: Address already in use
Error creating server listener on port 5222: Address already in use
The way I fixed this, I had to actually turn off the server inside the admin area for my host.
我解决这个问题的方法是,我必须实际关闭主机管理区域内的服务器。
回答by SzB
It can be also caused by double definition of port 8080 in ..\tomcat\conf\server.xml :
也可能是 ..\tomcat\conf\server.xml 中对 8080 端口的双重定义造成的:
<Connector port="8080"
enableLookups="false" redirectPort="8443" debug="0"/>
<Connector port="8080"
enableLookups="false" address="127.0.0.1" maxParameterCount="30000"/>
回答by CodeQ
In windows this scenario happens when Eclipse crashes without a clean shutdown it will have the local Jetty or Tomcat server keep running. When you reopen Eclipse and try to start server again this will lead to the "Address already in use: JVM_Bind"
在 Windows 中,当 Eclipse 在没有干净关闭的情况下崩溃时,就会发生这种情况,它会使本地 Jetty 或 Tomcat 服务器继续运行。当您重新打开 Eclipse 并尝试再次启动服务器时,这将导致“地址已在使用中:JVM_Bind”
You can solve this by opening Task Manager and find the javaw.exe process and ending it.
您可以通过打开任务管理器并找到 javaw.exe 进程并结束它来解决此问题。
Then you can restart the server on Eclipse.
然后您可以在 Eclipse 上重新启动服务器。
回答by BlondCode
I had the same on Windows. My solution was to get which port the debug wants to connect to. (In IntelliJ a red rectangle already giving the info: "Error running Tomcat: Unable to open debugger port (127.0.0.1:XXXXX): ... Already in use...") Let's say XXXXX is the port number. Then i searched for the problem and the PID in a cmd window:
我在 Windows 上也有同样的情况。我的解决方案是获取调试想要连接到的端口。(在 IntelliJ 中,一个红色矩形已经给出了信息:“运行 Tomcat 时出错:无法打开调试器端口(127.0.0.1:XXXXX):......已经在使用......”)假设 XXXXX 是端口号。然后我在 cmd 窗口中搜索了问题和 PID:
netstat -ano | find "CLOSE_WAIT" | find ":XXXXX"
I got the PID number as the last number in the result line. (Let's say YYYY) Finally:
我得到了 PID 号作为结果行中的最后一个数字。(假设 YYYY) 最后:
TASKKILL /PID YYYY
An extra info: Winscp logged out meanwhile, probably it was causing my problem. :)
额外信息:Winscp 同时注销,可能是我的问题造成的。:)