2012-05-16 81 views
8

我試圖在Windows 7 64位和32位Java上第一次安裝Jenkins-1.464作爲Windows服務。不過,當我運行它時拋出異常。在Windows上運行Jenkins時出現異常

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端口通過--httpPort論點jenkins.xml改變HTTP端口
  • 關閉Windows防火牆

但它不能解決問題。

我該如何解決?

回答

31

問題通過運行jenkins與--ajp13Port=-1解決。它將禁用Apache JServ協議v1.3的偵聽器。您也可以將端口更改爲未使用的端口。

運行java -jar jenkins.war --ajp13Port=-1 --httpPort=8082詹金斯成功啓動並且可以訪問通過http://localhost:8082/

+0

這爲我工作。我將Jenkins安裝在一個框中,我們使用Apache/Tomcat運行Solr搜索引擎。 Tomcat綁定到端口8009的AJP/1.3連接器。 –

2

後,我發現,最有用的信息是:

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

正如你可能知道,這是典型的Apache JServ的協議AJP連接器端口。

正在運行netstat -ano我發現另一個進程正在監聽此端口而不是詹金斯。在我的情況下,一位同事安裝了YouTrack,並且該服務在Jenkins之前已經啓動。這使詹金斯不高興。

我停止了YouTrack服務,啓動了Jenkins,然後重新啓動了YouTrack,每個人都很開心。

2

更新jenkins.xml到

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --ajp13Port=-1 --httpPort=8082</arguments> 
相關問題