FitNesse with Jenkins: BindException - Possible port clash? - java

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:
How do I get rid of this error?
Why does FitNesse connects to port 8086? Is there a configuration for that?
What has FitNesse do to with our Jenkins Java 6 instance? I don't really see the link here.
Is the port 8090 for FitNesse not well chosen? I tried to change it to 8050 but the error occurs as well.

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.

Related

Spring Boot in Docker container behind Nginx reverse proxy not working

I have a problem with a Spring Boot application running inside docker container, which is running behind nginx reverse proxy.
To check that docker and nginx are working correctly I've tried folloging, which worked as expected:
docker run -d -p 9001:80 nginx:alpine
My nginx config looks like
server {
server_name xyz.com;
listen 80;
location / {
proxy_pass http://localhost:9001;
}
}
Now I'm able to reach the nginx welcome page from the internet via xyz.com and let's assume the server's IP address is 123.123.1.1, via http://123.123.1.1:9001 as expected.
Also on the server itself, I get the welcome page via
curl http://localhost:9001
I think that shows, that docker and nginx are working as expected.
Let's go further down towards my problem.
Now I have build a simple Spring Boot application, which is bind to address 0.0.0.0 and port 9001. (Of course I have stopped the nginx container before going on...)
After the maven build, I have started the application with
java -jar app.jar
After it started up, I can reach it on the server with
curl http://localhost:9001
and from the internet via xyz.com and http://123.123.1.1:9001 - everything fine as expected.
Now, I've stopped the application und build a Dockerfile:
FROM amazoncorretto:11-alpine-jdk
COPY target/app.jar app.jar
ENTRYPOINT ["java", "-jar","/app.jar"]
First building the image with docker build -t app:latest . and afterwards run the container with docker run -p 9001:9001 -d app:latest. So far so good, the container starts up - fine.
And here is the problem:
I'm not able to reach the application neither via xyz.com nor on the server witch curl http://localhost:9001! But via http://123.123.1.1:9001 it worked!
I've tried to check it inside the container docker exec -it [container] sh and afterwards # wget localhost:9001 worked fine. # netstat -tulpn on the container itself brings following
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN 1/java
Also on the server $ netstat -tulpn shows the following:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN 607173/docker-proxy
tcp6 0 0 :::9001 :::* LISTEN 607180/docker-proxy
Maybe something with iptables, but not sure what.
Hopefully somebody out there has an idea to help me.
Thanks in advance!
Update
When I used port 80 inside the container (The Spring Boot application listen now on port 80 instead of 9001) - magically it works! Tried port 8080 inside the container also - this didn't work!
Looks like a port problem, maybe someone can explain where the problem is?!

Can't access to remote pentaho bi-server

I uploaded mi "pentaho biserver-ce-6.0.1.0-386" to my hosting and set the variables needed but i keep getting error like this:
04-Mar-2016 11:14:27.427 SEVERE [localhost-startStop-1]
org.apache.tomcat.util.descriptor.web.SecurityConstraint.findUncoveredHttpMethods
For security constraints with URL pattern [/jsp/*] only the HTTP
methods [POST GET] are covered. All other methods are uncovered.
I didn't find a guide-tutoial for biserver on a remote hosting in my pc in local is working perfectly
I modified the web.xml to my domain name, I have mi pentahoo bi-server under the directory "demo-odoo.ecommlean.com/pentaho"
eco.web08 ~ # cat /var/www/demo-odoo.ecommlean.com/htdocs/pentaho/biserver-ce/tomcat/logs/pentaho.log
2016-03-04 11:13:21,975 INFO [org.pentaho.platform.osgi.KarafInstance] ******************************************************************************* * Karaf
Instance Number: 1 at /var/www/demo-odoo.ecommlean.com/htdocs/pen taho/biserver-ce/pentaho-solutions/system/karaf//data1 Karaf Port:8801
OSGI Service Port:9050 JMX RMI Registry Port:11098 RMI Server Port:44444 *
******************************************************************************* 2016-03-04 11:13:29,897 INFO [org.pentaho.di] 2016/03/04 11:13:29 - cfgbuilder -
Warning: The configuration parameter [org] is not supported by the default configuration builder for scheme: sftp 2016-03-04 11:13:40,657 ERROR
[org.pentaho.di.osgi.KarafLifecycleListener] The Kettle Karaf Lifycycle Listener failed to execute properly. Releasing lifecycle hold, but some services may be
unavailable. 2016-03-04 11:13:51,859 ERROR [org.apache.felix.configadmin.1.8.0] [[org.osgi.service.cm.ConfigurationAdmin]]Cannot use configuration
org.pentaho.requirejs for [org.osgi.service.cm.ManagedService, id=562, bundle=187/mvn:pentaho/pentaho-requirejs-osgi-manager/6.0.1.0-386]: No visibility to
configuration bound to mvn:pentaho/pentaho-server-bundle/6.0.1.0-386
netstat -an | grep -w -e 8801 -e 9050 -e 11098 -e 44444
tcp6 0 0 :::11098 :::* LISTEN
tcp6 0 0 :::44444 :::* LISTEN
tcp6 0 0 127.0.1.1:44444 127.0.0.1:47797 ESTABLISHED
tcp6 0 0 127.0.0.1:47797 127.0.1.1:44444 ESTABLISHED
I attach my logs and web.xml
logs
According to logs attached server even was not started properly since there is a lot of exceptions on port 8080 already in use.
I would try to stop server, using kill to release ports and make attempt to start again.
Make sure you are really want to start remote server on 8080 port.

Cannot connect to localhost using service:jmx/rmi//..... When Using Visual VM with Tomcat within Vagrant

I've got a vagrant VM which is running tomcat and I wanted to connect VisualVM to monitor the performance of the VM during some tests.
I followed this guide to setup this configuration which recommended creating a setenv.sh script and placing it within /usr/share/tomcat7/bin. I found that setenv wasn't being run, so I placed the following in /etc/tomcat/tomcat.conf instead:
JAVA_OPTS="-Dcom.sun.management.jmxremote=true - Dcom.sun.management.jmxremote.port=9901 -Dcom.sun.management.jmxremote.ssl=false
m.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.rmi.port=9909"
I believe that the config is working as when running the following, I can see the ports active:
[vagrant#localhost ~]$ netstat -lntu | grep 99
tcp6 0 0 :::9901 :::* LISTEN
tcp6 0 0 :::9909 :::* LISTEN
Here is my config from the vagrant file:
# Ports enabled for VisualVM to work.
config.vm.network "forwarded_port", guest: 9901, host: 9905
config.vm.network "forwarded_port", guest: 9909, host: 9907
However after entering the following config, or close variations of (have tried 127.0.0.1 & enabling "do not require SSL" all I get is " ".
I have also tried ports 9901, 9905, 9909.
Any thoughts on how to solve this?

Could not start GlassFish 4.0 (Windows) - port 1527 - Address already in use

I'm a newbie in Java EE 7.
I have Netbeans 7.4 with GlassFish 4.0 and Java EE 7. In a 64-bit Windows 8.1 Pro machine. I want to start the GlassFish 4.0 Server, so I clicked on the services tab in Netbeans and then in the Servers option I right-clicked GlassFish Server 4.0 and then clicked Start.
When I did that I got the following message: "Could not start GlassFish Server 4.0: HTTP or HTTPS listener port is occupied while server is not running". I have also the IIS server, but I stopped it. After stopping IIS I tried to start again the GlassFish but it showed me the same message.
Also there is a window in Netbeans called Output - Java DB Database Process and it showed me the following:
Tue May 06 22:03:11 GMT-05:00 2014 : Security manager installed using the Basic server security policy.
Tue May 06 22:03:11 GMT-05:00 2014 Thread[main,5,main] java.io.FileNotFoundException: D:\Users\Juan Jose\.netbeans-derby\derby.log (Access is denied)
Tue May 06 22:03:12 GMT-05:00 2014 : Could not listen on port 1527 on host localhost:
java.net.BindException: Address already in use: JVM_Bind
Tue May 06 22:03:12 GMT-05:00 2014 : Could not listen on port 1527 on host localhost:
java.net.BindException: Address already in use: JVM_Bind
I ran a netstat -a in Windows to see what was happening with the 1527 port and that port is in LISTENING mode.
So how can I know what application or process is ocuppying the 1527 port?
Thanks for your help !!
To find the process1 that keeps the busy port, try the following command:
netstat -ano | find "1527"
This will show a line with the port and the identifier of the process. e.g.:
TCP 127.0.0.1:1527 0.0.0.0:0 LISTENING 2268
Once you have the process ID (e.g. 2268), run the following command for release the port (this will kill the process):
taskkill /F /PID 2268
Now, try to start Glassfish.
On Linux:
lsof -Pnl +M -i6 | grep 1527
Produces:
java 31139 1001 32u IPv6 114916062 0t0 TCP 127.0.0.1:1527 (LISTEN)
Killed with:
kill -9 31139
1 If you want to know the associated program, see How do I find out what service is using a certain port?
If the above doesn't work for anyone pls follow the below steps.. Sure It will work..
Go to C:\Program Files\glassfish-4.1\glassfish\domains\domain1\config
Open "domain.xml" in a xml editor or u can use notepad++
Find "8080"(below highlighted for ur reference)
network-listener port="8080" protocol="http-listener-1"
transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"
Replace "8080" with any open port. If you don't know how to find out open port try to use port no "3702" then save your file
now run your project
After running the project please have an eye on the URL
http://localhost:8080/...... should be http://localhost:3702/.....
To get open ports follow the below steps
open cmd.exe
execute cmd "netstat -ano"
Pick any one which you find is free(Like inside the green box above )
This is not an error you need to worry about. When you start GlassFish, NetBeans will also start the JavaDB (aka, Derby) database, which listens on port 1527 by default. When you shut down NetBeans, it will shut down GlassFish but will not shut down JavaDB. Therefore, when you start NetBeans a second time, NetBeans will try to start JavaDB again and fail because it is already running and listening on port 1527.
To shut down the database, you can use the NetBeans Services(Tab)->Databases->JavaDB(right click->Stop Server. To shut down from the command line use $NETBEANS_HOME/glassfish-4.0/javadb/bin/stopNetworkServer, where $NETBEANS_HOME is the top-level directory where NetBeans is installed (at least on Mac/Linux/Unix).

Deployment error:Starting of Tomcat failed, the server port 8080 is already in use

When I run my Java project using Netbeans I get the following error:
Deployment error:
Starting of Tomcat failed, the server port 8080 is already in use.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:166)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor619.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: org.netbeans.modules.j2ee.deployment.impl.ServerException: Starting of Tomcat failed, the server port 8080 is already in use.
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance._start(ServerInstance.java:1297)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1251)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1062)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.start(ServerInstance.java:939)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.startTargets(TargetServer.java:428)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:143)
... 16 more
BUILD FAILED (total time: 4 seconds)
I tried changing the server port to 8081 and shutdown port in tool->server. It runs fine but again if I do any operations and run the project it says "Deployment error:Starting of Tomcat failed, the server port 8081 is already in use"
What would be the problem?
goto command prompt
netstat -aon
for linux
netstat -tulpn | grep 'your_port_number'
it will show you something like
TCP 192.1.200.48:2053 24.43.246.60:443 ESTABLISHED 248
TCP 192.1.200.48:2055 24.43.246.60:443 ESTABLISHED 248
TCP 192.1.200.48:2126 213.146.189.201:12350 ESTABLISHED 1308
TCP 192.1.200.48:3918 192.1.200.2:8073 ESTABLISHED 1504
TCP 192.1.200.48:3975 192.1.200.11:49892 TIME_WAIT 0
TCP 192.1.200.48:3976 192.1.200.11:49892 TIME_WAIT 0
TCP 192.1.200.48:4039 209.85.153.100:80 ESTABLISHED 248
TCP 192.1.200.48:8080 209.85.153.100:80 ESTABLISHED 248
check which process has binded your port. here in above example its 248 now if you are sure that you need to kill that process fire
Linux:
kill -9 248
Windows:
taskkill /f /pid 248
it will kill that process
If you are behind a proxy server this issue could happen
i had the same issue and was solved by:
Preferences -> General -> Proxy Settings -> No Proxy.
"Maybe the tomcat ready-message was sent to the proxy - and never reached the IDE."
found #: https://netbeans.org/bugzilla/show_bug.cgi?id=231220
I had the same problem when trying to deploy, tomcat failed to restart as Tomcat instance was running. Close the IDE and check TASk Manager - kill any javaw process running, that solved the problem for me.
Take a look on your running processes, it seems like your current Tomcat instance did not stop. It's still running and NetBeans tries to start a second Tomcat-instance.
Thats the reason for your exception, you just have to stop the first instance, or deploy you code on the current running one
By changing proxy settings to "no proxy" in netbeans the tomcat prbolem got solved.Try this it's seriously working.
If on Linux you can kill existing Tomcats with this script
#/bin/bash
if [ `whoami` != root ]; then
echo "Please run this script as root or using sudo"
exit
fi
echo
echo "finding proceses that have name java and established connections status"
echo
echo "Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name"
netstat --tcp --programs | grep "ESTABLISHED" | grep "java"
echo
echo "finding proceses that use port 8080 or http-alt"
echo
netstat --tcp --programs | grep ':8080\|:http-alt'
echo -n "Do you wish to kill a process listed above?[Y/n]"
read choose
if [ "$choose" = "Y" ] || [ "$choose" = "y" ] || [ -z "$choose" ]
then
echo "enter pid to kill"
read procesId
kill -9 $procesId
fi
echo "done exiting"
exit 0
Kill the previous instance of tomcat or the process that's running on 8080.
Go to terminal and do this:
lsof -i :8080
The output will be something like:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 76746 YourName 57u IPv6 0xd2a83c9c1e75 0t0 TCP *:http-alt (LISTEN)
Kill this process using it's PID:
kill 76746
Select the project -> Right-Click -> clean and build and then run the project again simply solve the problem for me.
As, multiple process could bind the same port for example port 8086, In that case I have to kill all the processes involved with the port with PID. That might be cumbersome.
Change your default port in [tomcat_home_dir]/conf/server.xml
find
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
change it to
<Connector port="8090" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Change your Tomcat port address to 8084 and Shut Down Port to 8025. This will resolve your problem.
In other cases antivirus programs may cause problems. I had this problem with K7 total security. In my case K7 Firewall was blocking the 8084 port. The simple solution is to add an exception to Netbeans in K7 Firewall list.
In order to do that, open K7 and goto Settings -> Firewall Settings -> select Applications tab and find Netbeans.
Select Netbeans and click on edit link. On next screen select Grant Full Network access radio button.
Now goto Netbeans and start the server.
I resolved it by replacing Tomcat 8.5.* with Tomcat 7.0.* version.
This error message can also be caused by SELinux. Check if SELinux is enabled with getenforce
You need to adjust SELinux to use your port and restart.
I.E.
semanage port -a -t http_port_t -p tcp 9080 2>/dev/null || semanage port -m -t http_port_t -p tcp 9080
I tried No Proxy Settings , killing the process id . Some times they do work, But unfortunately they did not this time. So I tried the following.
In the Services Tab in NetBeans - Right Click on Apache Server {Version} - Platform Tab - Uncheck "Use IDE Proxy Settings". This solved the issue in my case.
I also had this problem. I changed port and did other things, but they didn't help me. In my case, I connected Tomcat to IDE after installing Netbeans (before). I just uninstalled Netbeans and Tomcat after that I reinstall Netbeans along with Tomcat (NOT separately). And the problem was solved.

Categories