jetty: Shit happens!!
Don’t set Jetty’s <stopPort> to the same <port> where Jetty is running or you might run into some nasty-hard-to-debug problem.
Now a full explanation:
Imagine the following scenario,
Here we have to web services, A and B, both running on the same machine on Jetty webserver and one of them is listening for petitions on port 9090 (configured via de maven-jetty-plugin). Web service A has to request some data to B and process its reply. Nothing unusual.
So A issue a request to http://localhost:9090/<path> expecting an XML response as a result of doing it. But it gets nothing, nada, nichts.
Well, at this moment the first thing that came through my mind was that I did something wrong while coding or configurating any of the web services. So I checked everything, but it seemed right. My next move was to create a fake request with curl just to see what happened.
What happened misleaded me even more: web service B was responding. WTF!!
So I went one level down. I ran tcpdump. And what I got? I discovered that the main difference between the requests issued by web service A and curl was the ip version they used: web service A was using ipv4 and curl ipv6.
To force both requests (from the web service and curl) to use ipv4, I run curl against the web service B but now instead of localhost I used 127.0.0.1. And the response was empty, just like if the request came from web service A.

So I thought that all of my troubles had to do with the ip stack beeing used. And I wasted some hours
trying to figure out what was wrong with it.
As I was really desperate with all this, I download Jetty sources to debug it on eclipse. I wanted to know
what was happening with my requests. And here was were light came to me by chance. While debugging Jetty,
an incomming connection from internet arraived to my <public_ip>:9090 (I guess it was someone doing some kind of portscanning) and got stuck on my breakpoints…
Mmmm, wait a moment…
Yep, internet addresses are ipv4 only (for most of us), so this ruled out any kind of problem with the ipv4 stack or shit. Now I began to see the light. This was some mess with the adresses.
Just to check I did an alias in my loopback interface to 127.0.0.2 and run again the request with curl to that ip. This time being successful. Ooook.
So, whats wrong with 127.0.0.1:9090?
Netstat output,
13:29:46 ~ $ netstat -f inet -an Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address Foreign Address (state) tcp4 0 0 127.0.0.1.9090 *.* LISTEN tcp46 0 0 *.9090 *.* LISTEN ...
Lsof output,
13:49:39 ~ $ lsof -i :9090 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 239 madtrick 94u IPv6 0x08c10f80 0t0 TCP *:websm (LISTEN) java 239 madtrick 95u IPv6 0x08c11460 0t0 TCP [::127.0.0.1]:websm (LISTEN)
I have two sockets listening on port 9090 and both belong to the same process (as reported by lsof), my Jetty Server. But requests to 127.0.0.1:9090 are lost meanwhile requests to <any_other_ip>:9090 are processed by the server.
Lets try something, lets change the <stopPort> to 9091 and see what happens…
Request from web service A, OK.
Request from curl, OK.
Run netstat again,
13:59:50 ~ $ netstat -f inet -an Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address Foreign Address (state) tcp4 0 0 127.0.0.1.9091 *.* LISTEN tcp46 0 0 *.9090 *.* LISTEN ...
And lsof for ports 9090 and 9091,
14:00:48 ~ $ lsof -i :9090 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 301 madtrick 93u IPv6 0x08c10f80 0t0 TCP *:websm (LISTEN)
14:00:55 ~ $ lsof -i :9091 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 301 madtrick 94u IPv6 0x08c11460 0t0 TCP [::127.0.0.1]:xmltec-xmlmail (LISTEN)
So you see, Jetty opens another socket which listens on 127.0.0.1:<stopPort> (lets call it jetty stop daemon) and being that an explicit address it has precedence over the catch all 0.0.0.0:9090 (where Jetty is listening). That’s why my requests to 127.0.0.1:9090 returned nothing.
This is what was happening before,
And this is whats happens now,
Category: java, programacion, shit 23 comments »






February 28th, 2013 at 8:38 pm
must check kmXTaOsm [URL=http://prada1outlet2online.medykblog.pl/ – prada outlet usa[/URL – to your friends ysVxXzwF [URL=http://prada1outlet2online.medykblog.pl/ – http://prada1outlet2online.medykblog.pl/ [/URL -
February 28th, 2013 at 8:52 pm
buy [URL=http://burberrytrenchcoat.devhub.com/ – burberry shirt[/URL – to your friends dOxKfrmT [URL=http://burberrytrenchcoat.devhub.com/ – http://burberrytrenchcoat.devhub.com/ [/URL -
March 1st, 2013 at 8:33 am
you must read [URL=http://blogg.sweside.com/coachbagsoutletonlinehh/ – outlet coach[/URL – to take huge discount fOotPqrV [URL=http://coachoutlethh.metroblog.com/ – http://worldmusicblog.net/coachhandbagsoutletonlineyu/ [/URL -
March 1st, 2013 at 10:34 am
you definitely love [URL=http://worldmusicblog.net/coachonlinehh/ – coach bags outlet online[/URL – suprisely DLYbcEVx [URL=http://coachhandbagsonlinehh.iwannayou.com/ – http://coachbagsoutletkk.blag.gy/ [/URL -
March 1st, 2013 at 11:46 am
check [URL=http://crowdpulp.com/burberryjacket85/ – burberry factory outlet[/URL – to your friends oUfvOeex [URL=http://burberrycoat85.newsblog.com/ – http://burberrytrench85.blag.gy/ [/URL -
March 1st, 2013 at 5:25 pm
buy a [URL=http://autoresponders.pro/free/burberryonline85/ – burberry outlet[/URL – for less IlcOgBrd [URL=http://burberryjacket85.urbanblog.dk/ – http://burberrytrench85.iwannayou.com/ [/URL -
March 1st, 2013 at 5:41 pm
get [URL=http://buylouisvuittononline.bloglines.co.za/ – buy louis vuitton online[/URL – for less OorbhqPI [URL=http://wheretobuylouisvuitton.techmaza.in/ – http://wheretobuylouisvuitton.xanga.com/ [/URL -
March 1st, 2013 at 8:29 pm
buy best [URL=http://buylouisvuitton.livejournal.com/ – buy louis vuitton handbags[/URL – to get new coupon cwBRbGYX [URL=http://buylouisvuitton.livejournal.com/ – http://buylouisvuitton.livejournal.com/ [/URL -
March 2nd, 2013 at 12:38 am
buy a [URL=http://buylouisvuitton.livejournal.com/ – buy louis vuitton handbags[/URL – , just clicks away BSedfMXt [URL=http://buylouisvuitton.livejournal.com/ – http://buylouisvuitton.livejournal.com/ [/URL -
March 2nd, 2013 at 12:39 am
must check [URL=http://worldmusicblog.net/buylouisvuittononline/2012/11/16/buy-louis-vuitton-onlinecheap-lv-handbags-with-the-perfect-fabricshigh-quality-low-price/ – buy louis vuitton online[/URL – to get new coupon zhJDJMkZ [URL=http://louisvuittonbuy.tsublog.tsukaeru.net/ – http://erekod.smkseta.com/buylouisvuitton/ [/URL -
March 2nd, 2013 at 2:25 am
check this link, [URL=http://burberrytrenchcoat.devhub.com/ – burberry men[/URL – , just clicks away enzCtJUu [URL=http://burberrytrenchcoat.devhub.com/ – http://burberrytrenchcoat.devhub.com/ [/URL -
March 2nd, 2013 at 9:46 pm
check [URL=http://burberrywallet85.mzk-pulawy.pl/ – burberry coat[/URL – and get big save eWPXmIjT [URL=http://burberryboots85.ahoban.com/posts/3 – http://decrypteurdetendances.com/burberrywallet85/ [/URL -
March 3rd, 2013 at 3:27 am
I’m sure the best for you [URL=http://coachhandbagsoutletkk.ahoban.com/posts/3 – coach online[/URL – to get new coupon VpIpZokt [URL=http://coachhandbagsonlinehh.iwannayou.com/ – http://coachoutlethh.metroblog.com/ [/URL -
March 3rd, 2013 at 3:58 am
you will like [URL=http://louisvuittonbuyonline.biztro.com.au/ – buy louis vuitton handbags[/URL – to your friends uXhhdVuk [URL=http://worldmusicblog.net/buylouisvuittononline/2012/11/16/buy-louis-vuitton-onlinecheap-lv-handbags-with-the-perfect-fabricshigh-quality-low-price/ – http://louisvuittonbuy.medykblog.pl/ [/URL -
March 3rd, 2013 at 4:02 am
order an [URL=http://krishnacommunity.com/burberrypolo85/ – burberry polo[/URL – for promotion code ZLsGyOCN [URL=http://burberrytie85.tsublog.tsukaeru.net/ – http://burberrytie85.tsublog.tsukaeru.net/ [/URL -
March 3rd, 2013 at 1:45 pm
???????? ?? ?????????? ?????? ???????, ????? ?????? ?????? ?????. ????????????? ?????? ?????????. ????? ????????????? ?????? ????????. ???? ????????? ???????? ? ???????? ?? ?????? ?? ????????, ???????? ?? ??? ? ???? (??? ????? ?? ??? ???). ???????? ??? ???????????? ???????????.
http://igroto4ka.ru/wp-content/uploads/2012/02/mist2-300×147.jpg
March 3rd, 2013 at 3:01 pm
sell [URL=http://burberrytrenchcoat.devhub.com/ – burberry outlet[/URL – for gift hTsmWJSX [URL=http://burberrytrenchcoat.devhub.com/ – http://burberrytrenchcoat.devhub.com/ [/URL -
March 3rd, 2013 at 6:31 pm
cheap [URL=http://buylouisvuitton.livejournal.com/ – buy louis vuitton bags[/URL – to take huge discount SKZMLXQP [URL=http://buylouisvuitton.livejournal.com/ – http://buylouisvuitton.livejournal.com/ [/URL -
March 4th, 2013 at 1:32 am
must look at this [URL=http://burberrytrenchcoat.devhub.com/ – burberry t shirt[/URL – suprisely HUkYzDsp [URL=http://burberrytrenchcoat.devhub.com/ – http://burberrytrenchcoat.devhub.com/ [/URL -
March 4th, 2013 at 8:31 am
cheap [URL=http://erekod.smkseta.com/guccishoponlinety/ – gucci online[/URL – for less XLUufxqM [URL=http://guccioutletqq.besthometreadmill.co.za/ – http://www.arunavi.jp/twiyodogawa/guccionlinety/ [/URL -
March 4th, 2013 at 3:27 pm
you must read [URL=http://www.blogvan.nl/coachpursesoutletonlinekk/ – coach bags outlet online[/URL – , just clicks away vgGRkCwQ [URL=http://www.arunavi.jp/twiyodogawa/coachpurseoutletonlineyu – http://www.arunavi.jp/twiyodogawa/coachpurseoutletonlineyu [/URL -
March 4th, 2013 at 3:47 pm
sell [URL=http://erekod.smkseta.com/buylouisvuitton/ – where to buy louis vuitton bags[/URL – , for special offer QclaZSCQ [URL=http://buylouisvuittononline.bloglines.co.za/ – http://www.photoblog.com/buylouisvuitton [/URL -
March 13th, 2013 at 12:46 pm
Following, consider the shade and structure of the meat. A wonderful steak should certainly be company towards the touch, moist, and vivid in shade. It have to be well marbled with skinny streaks of white body fat all through plus a skinny crust of meat around the exterior. In our additional fat informed culture, we are most likely to show up for lean cuts of meat, however the skinny streaks of white excess fat marbled throughout the meat christian louboutin shoes will certainly be the vital in to a tender juicy meat. christian louboutin outlet store http://www.christianlouboutinoutlet2013shop.com/