Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception when running Jenkins on Windows

I'm trying to install Jenkins-1.464 at the first time as the windows service on Windows 7 64-bit with 32-bit Java. However exception is thrown when I run it.

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)

I've already tried:

  • changing HTTP port through --httpPort command line option
  • changing HTTP port through --httpPort argument in jenkins.xml
  • turning off Windows firewall

But it doesn't solve the issue.

How do I fix it?

like image 554
Andrei Botalov Avatar asked May 16 '12 21:05

Andrei Botalov


People also ask

Can I run Jenkins on Windows?

You can now install Jenkins on Windows and start creating your continuous integration pipeline. You are well on your way to becoming an automation and CI/CD expert. Jenkins enables you to incorporate your development processes in a CI/CD pipeline.

What are prerequisites to install Jenkins on Windows?

Prerequisites. Minimum hardware requirements: 256 MB of RAM. 1 GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a Docker container)

Can't start the Jenkins service on local computer?

Solution: One of the most common reasons why Jenkins server can't start in Windows computers is because the version of the Java language was updated after the last shutdown of Jenkins server.

How do I unlock Jenkins Windows?

When installing Jenkins, a password is generated and in order to manage Jenkins you have to get it. To unlock Jenkins, means to find the admin password and connect for the first time to it. Close the window or install the Jenkins plugins you need. Now you can press on "Start using Jenkins" and enjoy Jenkins.


2 Answers

Issue is solved by running jenkins with --ajp13Port=-1. It will disable listener of Apache JServ Protocol v1.3. You can also change port to unused one.

After running java -jar jenkins.war --ajp13Port=-1 --httpPort=8082 Jenkins started successfully and is accessible through http://localhost:8082/

like image 116
Andrei Botalov Avatar answered Oct 13 '22 17:10

Andrei Botalov


I found that the most useful message was:

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

As you probably know, this is the typical Apache JServ Protocol AJP Connector port.

Running netstat -ano I found that another process was listening on this port instead of Jenkins. In my case a colleague had installed YouTrack and that service had been started before Jenkins. This made Jenkins unhappy.

I stopped the YouTrack service, started Jenkins and then restarted YouTrack and everyone was happy.

like image 40
nbw Avatar answered Oct 13 '22 19:10

nbw