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 7565583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:11:33+00:00 2026-05-30T14:11:33+00:00

I am using Jersey for both service and client. When I am trying to

  • 0

I am using Jersey for both service and client. When I am trying to call the service, I get this error:

Exception in thread "main" com.sun.jersey.api.client.UniformInterfaceException: GET http://localhost:8080/Maze/rest/service/overview?countryid=1 returned a response status of 204 No Content
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:528)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:506)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:674)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:503)
at com.maze.client.MyClient.overviewTest(MyClient.java:34)
at com.maze.client.MyClient.main(MyClient.java:64)

I do not understand why.

Here is the service:

@GET
@Produces(MediaType.APPLICATION_JSON )
@Path("/overview")
public JSONArray getOverviewEntities(@QueryParam("countryid")String id){
    JSONArray array = null;
    try{
    Integer countryId = Integer.parseInt(id);
    ArrayList<Event> list = new ArrayList<Event>();
    EventService event = new EventService();
    EntityManagerSingleton.getInstance().getTransaction().begin();
    list.addAll(event.getList(countryId, "country", 5));
    EntityManagerSingleton.getInstance().getTransaction().commit();
    for(Event ev : list){
        array.add(EventService.toJSONObject(ev));
    }
    } catch(Exception e){
        e.printStackTrace();
    }
    return array;
}

and this is the client:

public static void overviewTest(){
    WebResource wbr;
    Client client = Client.create();
    wbr = client.resource("http://localhost:8080/Maze/rest/service/overview");  
    JSONArray result = wbr.queryParam("countryid", "1").accept(MediaType.APPLICATION_JSON).get(JSONArray.class);
    System.out.println(result.toString());
}

I really have no idea about what the problem could be. I am aware of another question here with a seemingly identical subject, but they are not.

Please let me know if I am missing something or if you need any extra info.

  • 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-30T14:11:34+00:00Added an answer on May 30, 2026 at 2:11 pm

    204 is an HTTP response status code informing the client that there is no content returned.
    When your client calls get(JSONArray.class) it’s expecting 200 with data, hence the exception.
    It looks from your server implementation that the array variable is never instantiated, so if your list were not empty, it would likely NPE in array.add(), but in this case it look like your list may be empty, so the for loop is not iterated up and getOverviewEntities method returns null, hence the 204 result.

    JSONArray array = new JSONArray(); // should fix the issue :)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I send GET requests using the Jersey Client API to a server
I'm creating a Jersey web service, and I've found myself using both of the
I'm using Jersey 1.11 and trying to model both POST and DELETE methods in
I have implement a web service using jersey and I have a client making
I am trying to study how the REST service approach works using Jersey. I
I'm using Jersey to create a REST web service for a server component. The
I have a REST service built using Jersey. I want to be able to
I have a JAX-RS web service (using jersey) that accepts a JAXB object as
Using Jersey and Jackson to create a REST interface, how do I get List
Using Jersey/JAX-RS I have a get handler that contains code to copy a large

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.