Markus L
Markus L

Reputation: 1014

FitNesse with Jenkins: BindException - Possible port clash?

It happens quite often (at least once under five runs) that running a FitNesse test results in this error message:

Unable to start test system 'slim': fitnesse.slim.SlimError: Got invalid slim header from client. Read the following:

the following seems to be empty thus the error message ends after the colon.

The log shows a BindException outside our own code:

Can not bind to port 8086. Aborting.
java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:376)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at java.net.ServerSocket.<init>(ServerSocket.java:128)
at fitnesse.socketservice.SocketFactory.createServerSocket(SocketFactory.java:33)
at fitnesse.slim.SlimService.<init>(SlimService.java:102)
at fitnesse.slim.SlimService.startWithFactory(SlimService.java:75)
at fitnesse.slim.SlimService.main(SlimService.java:56)

The reason for this seems to be a port clash. FitNesse and Jenkins run on the same machine.

FitNesse runs on port 8090 under the user "jenkins" with Java 7:

% netstat -plten | grep 8090
tcp6       0      0 :::8090                 :::*                    LISTEN      113        213626367   17072/java

% ps aux | grep 17072
jenkins  17072  0.5  0.5 9299292 130676 ?      Sl   13:25   0:04 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -jar /opt/FitServer/fitnesse.jar -p 8090

Port 8086 is used by Jenkins with the latest Java 6 version. This instance is needed for all our projects which build on a remote host without Java 7 installed. The error occurs when running the test from the browser (address: jenkins:8090/TestEnvironment/TestSuite) as well as automatic jobs from Jenkins.

% netstat -plten | grep 8086
tcp6       0      0 :::8086                 :::*                    LISTEN      118        134031785   32343/java

% ps aux | grep 32343
jenkins+ 32343  0.7  1.5 15745712 384180 ?     Sl   Jun01 197:53 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins-java6/jenkins-java6.war --webroot=/var/cache/jenkins-java6/war --httpPort=8086 --ajp13Port=-1

Now for the questions:

Upvotes: 0

Views: 340

Answers (1)

Fried Hoeben
Fried Hoeben

Reputation: 3272

The default port used by Slim is indeed close to the 8086 you report: see the section 'Configure SLIM' on http://www.fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.WritingAcceptanceTests.SliM

You should be able to get it to use a different port (range) by overriding the slim.port property. Either via supplying an extra property to your FitNesse startup script, or placing it in `plugins.properties':

Those properties can be either provided by a wiki page, on the command line (e.g. -Dslim.port=9000) or in the plugins.properties file.

Upvotes: 1

Related Questions