2011/08/13

org.jboss.netty.channel.ChannelException: Failed to bind to: /127.0.0.1:XXX

This exception:

org.jboss.netty.channel.ChannelException: Failed to bind to: /127.0.0.1:1234
        at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:303)
        at org.geoaire.jobscheduler.server.netty.JSServer.start(JSServer.java:82)
        at org.geoaire.jobscheduler.server.Server.process(Server.java:83)
        at org.geoaire.jobscheduler.server.ui.cli.main.Main.run(Main.java:65)
        at org.geoaire.common.ui.cli.CommonMain.start(CommonMain.java:95)
        at org.geoaire.jobscheduler.server.ui.cli.main.Main.main(Main.java:93)
Caused by: java.net.BindException: Cannot assign requested address
        at sun.nio.ch.Net.bind(Native Method)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
        at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.bind(NioServerSocketPipelineSink.java:148)
        at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleServerSocket(NioServerSocketPipelineSink.java:100)
        at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:74)
        at org.jboss.netty.channel.Channels.bind(Channels.java:468)
        at org.jboss.netty.channel.AbstractChannel.bind(AbstractChannel.java:200)
        at org.jboss.netty.bootstrap.ServerBootstrap$Binder.channelOpen(ServerBootstrap.java:348)
        at org.jboss.netty.channel.Channels.fireChannelOpen(Channels.java:176)
        at org.jboss.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:85)
        at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:142)
        at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:90)
        at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:282)
        ... 5 more


may have several causes but sometimes you just need to check out the basics... did you check the plug?

Well, in my case this was a little "virtual" because the unconnected device was the loopback network interface! Yep, I lost it after playing with my network definitions... :-P

As David J. Agans mentioned in the chapter 9 of his useful book Debugging, there is a process to debugging anything and one step is to check the basics as "Check the plug". Ok, I recognize that it took me a time to remember this simple stuff... but the lesson is now very fresh.

So after editing /etc/network/interfaces and bringing back my lo interface, the program run ok.

No comments:

Post a Comment