简体   繁体   English

jenkins 更新错误:java.net.BindException:地址已在使用中

[英]jenkins update error: java.net.BindException: Address already in use

I just got started with Jenkins, and I'm just trying to update.我刚开始使用 Jenkins,我只是在尝试更新。

FYI I have already read this: Unable to start Jenkins仅供参考我已经读过这个: 无法启动詹金斯

I also tried this: http://www.ramk.io/2014/06/updating-jenkins-ci-server-on-mac-os-x/我也试过这个: http ://www.ramk.io/2014/06/updating-jenkins-ci-server-on-mac-os-x/

I am having issues even when Jenkins is the only thing running on port 8080.即使 Jenkins 是唯一在 8080 端口上运行的东西,我也遇到了问题。

The full error when I try to run:我尝试运行时的完整错误:

java jar jenkins.war

I get this stacktrace:我得到这个堆栈跟踪:

java -jar /Applications/Jenkins/jenkins.war
Running from: /Applications/Jenkins/jenkins.war
webroot: $user.home/.jenkins
Dec 17, 2015 1:38:14 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Dec 17, 2015 1:38:14 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: jetty-winstone-2.9
Dec 17, 2015 1:38:15 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
Jenkins home directory: /Users/EightArmCode/.jenkins found at: $user.home/.jenkins
Dec 17, 2015 1:38:16 PM org.eclipse.jetty.util.log.JavaUtilLog warn
WARNING: FAILED SelectChannelConnector@0.0.0.0:8080: java.net.BindException: Address already in use
java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:433)
    at sun.nio.ch.Net.bind(Net.java:425)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:187)
    at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
    at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:265)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.Server.doStart(Server.java:293)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at winstone.Launcher.<init>(Launcher.java:156)
    at winstone.Launcher.main(Launcher.java:356)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at Main._main(Main.java:293)
    at Main.main(Main.java:98)

Dec 17, 2015 1:38:16 PM org.eclipse.jetty.util.log.JavaUtilLog warn
WARNING: FAILED org.eclipse.jetty.server.Server@2db7a79b: java.net.BindException: Address already in use
java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:433)
    at sun.nio.ch.Net.bind(Net.java:425)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:187)
    at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
    at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:265)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.Server.doStart(Server.java:293)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at winstone.Launcher.<init>(Launcher.java:156)
    at winstone.Launcher.main(Launcher.java:356)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at Main._main(Main.java:293)
    at Main.main(Main.java:98)

Dec 17, 2015 1:38:16 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: stopped w.{,file:/Users/EightArmCode/.jenkins/war/},/Users/EightArmCode/.jenkins/war
Dec 17, 2015 1:38:16 PM winstone.Logger logInternal
INFO: Winstone shutdown successfully
Dec 17, 2015 1:38:16 PM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.IOException: Failed to start Jetty
    at winstone.Launcher.<init>(Launcher.java:158)
    at winstone.Launcher.main(Launcher.java:356)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at Main._main(Main.java:293)
    at Main.main(Main.java:98)
Caused by: java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:433)
    at sun.nio.ch.Net.bind(Net.java:425)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:187)
    at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
    at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:265)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.Server.doStart(Server.java:293)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at winstone.Launcher.<init>(Launcher.java:156)
    ... 7 more

Dec 17, 2015 1:38:17 PM hudson.util.BootFailure publish
SEVERE: Failed to initialize Jenkins
hudson.util.HudsonFailedToLoad: java.lang.InterruptedException
    at hudson.WebAppMain$3.run(WebAppMain.java:237)
Caused by: java.lang.InterruptedException
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:502)
    at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:267)
    at jenkins.InitReactorRunner.run(InitReactorRunner.java:44)
    at jenkins.model.Jenkins.executeReactor(Jenkins.java:924)
    at jenkins.model.Jenkins.<init>(Jenkins.java:816)
    at hudson.model.Hudson.<init>(Hudson.java:83)
    at hudson.model.Hudson.<init>(Hudson.java:79)
    at hudson.WebAppMain$3.run(WebAppMain.java:225)

As I mentioned, I have tried checking what else is running on 8080:正如我所提到的,我已经尝试检查 8080 上还有什么正在运行:

sudo lsof -i :8080
COMMAND PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    810 jenkins  156u  IPv6 0x2e7be7a88f4bb833      0t0  TCP *:http-alt (LISTEN)

Try to run jenkins with command:尝试使用以下命令运行 jenkins:

java -jar jenkins.war --httpPort=XXXX

where XXXX is port different than default one 8080其中 XXXX 是与默认端口不同的端口 8080

I was able to solve this problem by killing the running java process in the Activity Monitor.我能够通过在活动监视器中终止正在运行的 java 进程来解决这个问题。 You can try the following:您可以尝试以下方法:

  1. Launch the Activity Monitor启动活动监视器
  2. Search for java搜索 java
  3. Select the running java process and click the (X) button at the top right corner of the window to kill it选择正在运行的java进程,点击窗口右上角的(X)按钮将其杀死
  4. Start the jenkins server启动詹金斯服务器

I eventually figured out how it works.我最终弄清楚了它是如何工作的。 You can kill jenkins, replace the jenkins.war file in the /Applications/Jenkins/ directory, and then restart it.可以kill jenkins,替换/Applications/Jenkins/目录下的jenkins.war文件,然后重启。

I had the same problem, every time I try to run the jar file.每次尝试运行 jar 文件时,我都遇到了同样的问题。 What I found is the jenkin is already running and so to solve it.我发现詹金已经在运行,所以要解决它。

  1. I stopped the running jenkins with sudo service jenkins stop first我先用sudo service jenkins stop停止了正在运行的詹金斯
  2. Than only run the command sudo java -jar jenkins.war比只运行命令sudo java -jar jenkins.war

In my i fixed issue by editing service file /lib/systemd/system/jenkins.service in this file set port in below line在我通过编辑服务文件/lib/systemd/system/jenkins.service在下一行的此文件集端口中修复了问题

Environment="JENKINS_PORT=xxxx"

Also after updating the service need to reload the deamon同样在更新服务后需要重新加载守护进程

sudo systemctl daemon-reload

Then start the Jenkins service然后启动Jenkins服务

sudo service jenkins restart

我使用了以下命令并能够登录到 Jenkins。

java -jar jenkins.war --httpPort=8081

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM