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

  • Home
  • SEARCH
  • 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 6998219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:23:00+00:00 2026-05-27T20:23:00+00:00

My code is: Client client = Client.create(); WebResource web_resource = client.resource(http://www.myhostname.com/); // String string

  • 0

My code is:

    Client client = Client.create();
    WebResource web_resource = client.resource("http://www.myhostname.com/");
    // String string = web_resource.path("foo").accept("text/xml").get(String.class);
    // Log.d(getClass().getCanonicalName(), "jax-rs client string = " + string);
    Num num = web_resource.path("foo").accept(MediaType.TEXT_XML_TYPE).get(Num.class);

The last line causes the problem, and I get a similar problem if I replace it with the 2 commented lines with the difference that I get the exception on a different line of MediaType.java.

E/AndroidRuntime(  840): Caused by: java.lang.NullPointerException
E/AndroidRuntime(  840):    at javax.ws.rs.core.MediaType.toString(MediaType.java:265)
E/AndroidRuntime(  840):    at com.sun.jersey.api.client.ClientRequest.getHeaderValue(ClientRequest.java:232)
E/AndroidRuntime(  840):    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.writeOutBoundHeaders(URLConnectionClientHandler.java:276)
E/AndroidRuntime(  840):    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:197)
E/AndroidRuntime(  840):    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:147)
E/AndroidRuntime(  840):    ... 17 more

jersey-client.jar and jersey-core.jar have been added to the package at the top level and have been added to libraries in build path.

AndroidManifest.xml contains:

    <uses-permission android:name="android.permission.INTERNET" />
  • 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-05-27T20:23:01+00:00Added an answer on May 27, 2026 at 8:23 pm

    This was a huge exercise. I believe I might be the only person yet who has gotten Jersey+JAXB working on Android. A specific answer won’t help because after I got around this NullPointerException I got another exception, and then another.

    I had to change source code for Jersey and JAXB in order to make this happen. And I also had to repackage the jars.

    Sorry I know this is a bad quality answer but please comment me if somebody really wants to go down this difficult path in which case I can retrace my steps and help out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code for server: http://stikked.com/view/64826511 Network Code for client: http://stikked.com/view/38974838 Basically, the client connects to
Client code is pretty simple: <form action=DDServlet method=post> <input type=text name=customerText> <select id=customer> <option
My service side code is implemented using Resteasy @GET @Path(/ad-details/{query}) @Produces(application/json) public String getAdDetails(@PathParam(query)
Client side javascript code creates some elements (about 50-100) in a cycle: for (var
I created a web-site for a client with W3C Valid XHTML and CSS Code,
Consider the following code: client.Send(data, data.Length, endpoint); byte[] response = client.Receive(ref endpoint); While, according
New day, new problem :-) Code: Client Side: void abw_Closed(object sender, EventArgs e) {
After trying to understand why client code is not rendered in a page (injected
I have some cross platform DNS client code that I use for doing end
I put a TCP server and client code in PIC controller. Now just wanted

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.