9

我第一次尝试将 Jenkins-1.464 安装为 Windows 7 64 位和 32 位 Java 上的 Windows 服务。但是,当我运行它时会引发异常。

C:\Jenkins>java -jar jenkins.war --httpPort=8082
Running from: C:\Jenkins\jenkins.war
webroot: $user.home/.jenkins
May 16, 2012 4:48:04 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Jenkins home directory: C:\Users\Andrey\.jenkins found at: $user.home/.jenkins
May 16, 2012 4:48:04 PM winstone.Logger logInternal
INFO: HTTP Listener started: port=8082
May 16, 2012 4:48:04 PM winstone.Logger logInternal
INFO: Winstone shutdown successfully
May 16, 2012 4:48:04 PM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.IOException: Failed to start a listener: winstone.ajp13.Ajp13Listener
        at winstone.Launcher.spawnListener(Launcher.java:229)
        at winstone.Launcher.<init>(Launcher.java:182)
        at winstone.Launcher.main(Launcher.java:384)
        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:273)
        at Main.main(Main.java:98)
Caused by: java.io.IOException: Failed to listen on port 8009
        at winstone.ajp13.Ajp13Listener.start(Ajp13Listener.java:89)
        at winstone.Launcher.spawnListener(Launcher.java:220)
        ... 8 more
Caused by: java.net.BindException: Address already in use: JVM_Bind
        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:84)
        ... 9 more
May 16, 2012 4:48:04 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.InitReactorRunner.run(InitReactorRunner.java:43)
        at jenkins.model.Jenkins.executeReactor(Jenkins.java:849)
        at jenkins.model.Jenkins.<init>(Jenkins.java:761)
        at hudson.model.Hudson.<init>(Hudson.java:81)
        at hudson.model.Hudson.<init>(Hudson.java:77)
        at hudson.WebAppMain$2.run(WebAppMain.java:217)
Exception in thread "pool-2-thread-2" java.lang.NullPointerException
        at org.jvnet.hudson.reactor.Reactor$1.run(Reactor.java:153)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Exception in thread "pool-2-thread-1" java.lang.NullPointerException
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:191)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

我已经尝试过:

  • 通过 --httpPort 命令行选项更改 HTTP 端口
  • 通过 jenkins.xml 中的 --httpPort 参数更改 HTTP 端口
  • 关闭 Windows 防火墙

但这并不能解决问题。

我如何解决它?

4

3 回答 3

33

通过运行 jenkins 可以解决问题--ajp13Port=-1。它将禁用 Apache JServ 协议 v1.3 的侦听器。您还可以将端口更改为未使用的端口。

运行java -jar jenkins.war --ajp13Port=-1 --httpPort=8082Jenkins 后成功启动并且可以通过http://localhost:8082/

于 2012-05-16T21:38:29.630 回答
2

我发现最有用的信息是:

Caused by: java.io.IOException: Failed to listen on port 8009

您可能知道,这是典型的 Apache JServ 协议 AJP 连接器端口。

运行netstat -ano我发现另一个进程正在侦听此端口而不是 Jenkins。就我而言,一位同事已经安装了 YouTrack,并且该服务在 Jenkins 之前就已启动。这让詹金斯很不高兴。

我停止了 YouTrack 服务,启动了 Jenkins,然后重新启动了 YouTrack,每个人都很高兴。

于 2012-05-18T16:22:18.357 回答
2

将 jenkins.xml 更新为

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war"  --ajp13Port=-1 --httpPort=8082</arguments>
于 2013-03-14T09:14:10.103 回答