无法在Mac上运行Jenkins

时间:2011-11-29 11:18:32

标签: macos continuous-integration hudson jenkins

我已经从Jenkins web site下载了Mac OS X本机程序包,安装了它,在http://localhost:8080/打开了我的浏览器并获得了包含此文本的错误页面:

Status Code: 404
Exception: Request URL / not found.<br><br>
Stacktrace:
Generated by Winstone Servlet Engine v0.9.10 at Tue Nov 29 12:00:52 CET 2011

我在jenkins.war找到了/Applications/Jenkins,并尝试使用java -jar jenkins.war运行它:

$ pwd
/Applications/Jenkins


$ ls
jenkins.war

$ java -jar jenkins.war
Running from: /Applications/Jenkins/jenkins.war
webroot: $user.home/.jenkins
[Winstone 2011/11/29 12:03:12] - Beginning extraction from war file
Jenkins home directory: /Users/zeljko/.jenkins found at: $user.home/.jenkins
[Winstone 2011/11/29 12:03:16] - Winstone shutdown successfully
[Winstone 2011/11/29 12:03:16] - Container startup failed
java.io.IOException: Failed to start a listener: winstone.HttpListener
    at winstone.Launcher.spawnListener(Launcher.java:250)
    at winstone.Launcher.<init>(Launcher.java:202)
    at winstone.Launcher.main(Launcher.java:398)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at Main._main(Main.java:268)
    at Main.main(Main.java:96)
Caused by: java.io.IOException: Failed to listen on port 8080
    at winstone.HttpListener.getServerSocket(HttpListener.java:117)
    at winstone.HttpListener.start(HttpListener.java:70)
    at winstone.Launcher.spawnListener(Launcher.java:241)
    ... 8 more
Caused by: java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:383)
    at java.net.ServerSocket.bind(ServerSocket.java:328)
    at java.net.ServerSocket.<init>(ServerSocket.java:194)
    at java.net.ServerSocket.<init>(ServerSocket.java:150)
    at winstone.HttpListener.getServerSocket(HttpListener.java:112)
    ... 10 more

Nov 29, 2011 12:03:16 PM jenkins.model.Jenkins$6 onAttained
INFO: Started initialization
Nov 29, 2011 12:03:16 PM hudson.WebAppMain$2 run
SEVERE: Failed to initialize Jenkins
java.lang.InterruptedException
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:244)
    at jenkins.model.Jenkins.executeReactor(Jenkins.java:816)
    at jenkins.model.Jenkins.<init>(Jenkins.java:730)
    at hudson.model.Hudson.<init>(Hudson.java:81)
    at hudson.model.Hudson.<init>(Hudson.java:77)
    at hudson.WebAppMain$2.run(WebAppMain.java:217)

由于错误消息显示Address already in use我尝试在另一个端口上运行它:

$ java -jar jenkins.war --httpPort=8081
Running from: /Applications/Jenkins/jenkins.war
webroot: $user.home/.jenkins
[Winstone 2011/11/29 12:11:26] - Beginning extraction from war file
Jenkins home directory: /Users/zeljko/.jenkins found at: $user.home/.jenkins
[Winstone 2011/11/29 12:11:27] - HTTP Listener started: port=8081
[Winstone 2011/11/29 12:11:27] - Winstone shutdown successfully
[Winstone 2011/11/29 12:11:27] - Container startup failed
java.io.IOException: Failed to start a listener: winstone.ajp13.Ajp13Listener
    at winstone.Launcher.spawnListener(Launcher.java:250)
    at winstone.Launcher.<init>(Launcher.java:203)
    at winstone.Launcher.main(Launcher.java:398)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at Main._main(Main.java:268)
    at Main.main(Main.java:96)
Caused by: java.io.IOException: Failed to listen on port 8009
    at winstone.ajp13.Ajp13Listener.start(Ajp13Listener.java:92)
    at winstone.Launcher.spawnListener(Launcher.java:241)
    ... 8 more
Caused by: java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:383)
    at java.net.ServerSocket.bind(ServerSocket.java:328)
    at java.net.ServerSocket.<init>(ServerSocket.java:194)
    at java.net.ServerSocket.<init>(ServerSocket.java:150)
    at winstone.ajp13.Ajp13Listener.start(Ajp13Listener.java:87)
    ... 9 more

Nov 29, 2011 12:11:27 PM jenkins.model.Jenkins$6 onAttained
INFO: Started initialization
Nov 29, 2011 12:11:27 PM hudson.WebAppMain$2 run
SEVERE: Failed to initialize Jenkins
java.lang.InterruptedException
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:244)
    at jenkins.model.Jenkins.executeReactor(Jenkins.java:816)
    at jenkins.model.Jenkins.<init>(Jenkins.java:730)
    at hudson.model.Hudson.<init>(Hudson.java:81)
    at hudson.model.Hudson.<init>(Hudson.java:77)
    at hudson.WebAppMain$2.run(WebAppMain.java:217)

但是我收到Address already in use错误消息,我尝试使用哪个端口无关紧要。

我已停止防火墙,以防万一(系统偏好设置&gt;安全&gt;防火墙&gt;停止)。它没有帮助。

我已将jenkins.war复制到/Users/zeljko/Jenkins,并尝试使用java -jar jenkins.warjava -jar jenkins.war --httpPort=8081运行它。相同的错误消息。

我已从网站下载Latest and greatest (1.441) jenkins.war,已将其移至/Users/zeljko/Jenkins,并尝试java -jar jenkins.warjava -jar jenkins.war --httpPort=8081。相同的错误消息。

环境:

Mac OS X 10.6.8

$ java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)

我正在浏览Jenkins web sitewikibook,搜索,但我只是不知道我必须做些什么才能让它发挥作用。

5 个答案:

答案 0 :(得分:19)

此问题似乎已添加到Jenkins的Jira中,希望很快就会修复:https://issues.jenkins-ci.org/browse/JENKINS-11714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

在我的10.7.2安装上,我通过创建缺少的Home文件夹并更改Jenkins的所有者来使其工作。

安装Jenkins后,运行以下命令:

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
sudo mkdir -p /Users/Shared/Jenkins/Home
sudo chown -R daemon /Users/Shared/Jenkins
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

答案 1 :(得分:8)

这解决了问题:

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

之后,我可以在java -jar jenkins.war运行/Users/zeljko/Jenkins

来源:https://stackoverflow.com/a/8008901/17469

答案 2 :(得分:7)

ajp尝试侦听8009.看起来你运行了tomcat(因此8080和8009已被占用)。启动Jenkins时关闭ajp。

开始于:

java -jar jenkins.war --httpPort=8081 --ajp13Port=-1

答案 3 :(得分:0)

看起来错误就是安装Mac OS X原生包。我尝试在刚刚下载java -jar jenkins.war的计算机上运行jenkins.war,它运行正常。现在看看如何运行或卸载本机包......

答案 4 :(得分:0)

这主要是由8080端口被其他进程使用引起的(大多数情况下它是一个tomcat java进程)。 所以一开始你应该执行:

lsof -i:8080

然后终止正在使用端口8080的进程。

之后,再次执行命令。

java -jar jenkins.war --httpPort=8081