Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.nio.channels.UnresolvedAddressException #1

Open
ghost opened this issue Aug 24, 2011 · 3 comments
Open

java.nio.channels.UnresolvedAddressException #1

ghost opened this issue Aug 24, 2011 · 3 comments

Comments

@ghost
Copy link

ghost commented Aug 24, 2011

Notice this happening on Android phones and Bug Labs Angstrum linux devices (sporadically), but not on Mac testing using NettyClient.

Caught exception: java.nio.channels.UnresolvedAddressException
java.nio.channels.UnresolvedAddressException
    at sun.nio.ch.Net.checkAddress(Net.java:48)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:505)
    at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.connect(NioClientSocketPipelineSink.java:140)
    at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:103)
    at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:60)
    at org.jboss.netty.channel.Channels.connect(Channels.java:541)
    at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:210)
    at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:227)
    at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:188)
    at com.albin.mqtt.IsidoreyClient.connect(IsidoreyClient.java:75)
    at com.albin.mqtt.IsidoreyClient.connect(IsidoreyClient.java:50)
    at bugcam_helloworld.servicetracker.BUGcam_helloworldServiceTracker.connect(BUGcam_helloworldServiceTracker.java:134)
    at bugcam_helloworld.servicetracker.BUGcam_helloworldServiceTracker.pubsub(BUGcam_helloworldServiceTracker.java:113)
    at bugcam_helloworld.servicetracker.BUGcam_helloworldServiceTracker.initServices(BUGcam_helloworldServiceTracker.java:84)
    at com.buglabs.application.AbstractServiceTracker.<init>(AbstractServiceTracker.java:73)
    at bugcam_helloworld.servicetracker.BUGcam_helloworldServiceTracker.<init>(BUGcam_helloworldServiceTracker.java:28)
    at bugcam_helloworld.Activator.start(Activator.java:20)
    at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:633)
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:1822)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1739)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1143)
    at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
    at java.lang.Thread.run(Thread.java:636)
@gfhuertac
Copy link

Same issue happeninig here.

@vuamitom
Copy link

vuamitom commented Nov 4, 2012

I encountered this issue on Android while testing over 3G.

@AlbinTheander
Copy link
Owner

The base reason for this problem is that the host you're trying to connect to can't be found. This doesn't mean that there is anything wrong with your host or host-name. When Android is switching network (different 3G-networks, 3G to WiFi, etc.) it sometimes takes a while before the DNS lookup is working correctly.

That being said, the MeQanTT API should handle this (and other possible problems) better. Wrapping the exception in a well documented exception, for example. Or even adding some retry functionality. As it is right now, you really need to wrap the connect call in a try-catch clause.

If I get a reason to return to this project, I'll add some error handling. Until then, I'm very grateful for anyone wanting to add it and give me a pull request. Hint, hint... :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants