Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7836791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:18:52+00:00 2026-06-02T14:18:52+00:00

My Netty communications classes work fine in a standard Java application but when I

  • 0

My Netty communications classes work fine in a standard Java application but when I run them in an Android application I get a NullPointerException.

My question is if any Netty experts could point in the right direction for resolving this. Is it an incompatibility issue issue with Android or can you see anything in the stack trace that might indicate what I may be doing wrong?

I am using netty-3.4.0.Final.jar

I have added the internet permission to the AndroidManifest.xml.
I have verified that I can successfully connect to the server using just raw socket (without Netty) in the android app.

After I call bootstrap.connect() I can suspend execution at breakpoints in two threads. One in exceptionCaught() and one in channelClosed().

The stack track below is from exception exceptionCaught().

The full source from this project is located on codeplex in the elvemobileandroid project.

I believe I actually saw the Android project work once which might indicate that the exception is not always thrown. Unfortunately I have not been able to get it to work again (even though I have made no project changes).

Thread [<1> main] (Suspended (breakpoint at line 172 in UptimeClientHandler))   
    UptimeClientHandler.exceptionCaught(ChannelHandlerContext, ExceptionEvent) line: 172    
    UptimeClientHandler(SimpleChannelUpstreamHandler).handleUpstream(ChannelHandlerContext, ChannelEvent) line: 117 
    DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline$DefaultChannelHandlerContext, ChannelEvent) line: 564    
    DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(ChannelEvent) line: 792    
    ReadTimeoutHandler(SimpleChannelUpstreamHandler).exceptionCaught(ChannelHandlerContext, ExceptionEvent) line: 143   
    ReadTimeoutHandler(SimpleChannelUpstreamHandler).handleUpstream(ChannelHandlerContext, ChannelEvent) line: 117  
    DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline$DefaultChannelHandlerContext, ChannelEvent) line: 564    
    DefaultChannelPipeline.sendUpstream(ChannelEvent) line: 559 
    Channels.fireExceptionCaught(Channel, Throwable) line: 533  
    NioClientSocketPipelineSink.connect(NioClientSocketChannel, ChannelFuture, SocketAddress) line: 152 
    NioClientSocketPipelineSink.eventSunk(ChannelPipeline, ChannelEvent) line: 97   
    DefaultChannelPipeline.sendDownstream(ChannelEvent) line: 574   
    Channels.connect(Channel, SocketAddress) line: 642  
    NioClientSocketChannel(AbstractChannel).connect(SocketAddress) line: 204    
    ClientBootstrap.connect(SocketAddress, SocketAddress) line: 230 
    ClientBootstrap.connect(SocketAddress) line: 183    
    ClientBootstrap.connect() line: 154 
    UptimeClient.run() line: 94 
    CommunicationTest.test() line: 32   
    ElveMobileActivity.onCreate(Bundle) line: 25    
    Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1047   
    ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2627  
    ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2679   
    ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125 
    ActivityThread$H.handleMessage(Message) line: 2033  
    ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
    Looper.loop() line: 123 
    ActivityThread.main(String[]) line: 4627    
    Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
    Method.invoke(Object, Object...) line: 521  
    ZygoteInit$MethodAndArgsCaller.run() line: 868  
    ZygoteInit.main(String[]) line: 626 
    NativeStart.main(String[]) line: not available [native method]  

This is my first post on stackoverflow, please let me know if there is any more information I may provide.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T14:18:55+00:00Added an answer on June 2, 2026 at 2:18 pm

    Thanks for pointing out the logcat window (I’m new to Eclipse).
    It showed another error:
    java.net.SocketException: Bad address family

    After doing some research I found this:
    http://code.google.com/p/android/issues/detail?id=9431

    The fix is to disable IPv6 when using the Emulator:

    java.lang.System.setProperty("java.net.preferIPv6Addresses", "false");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have experimenting with netty-4-alpha, websockets (great work!) + SSL on native Android communicating
I am using Netty as backend in a Java-based Usenet client. The library is
My TCP server is implemented using Netty. My client using vanilla java.net.Socket to connect
I am writing a netty client and server application that will write JVM GC
I'm trying to run Netty Draft10 latest example on top of SSL (WSS) https://github.com/netty/netty/tree/master/src/main/java/org/jboss/netty/example/http/websocketx/server
The question is in the title but to elaborate a bit. If I'm writing
I have been studying Netty and Mina but am confused as to the best
First to say I'm n00b in Java. I can understand most concepts but in
I am writing a distributed Java application that will make heavy use of networking,
I am considering moving my Java NIO implementation over to JBoss Netty as it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.