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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:58:30+00:00 2026-06-02T22:58:30+00:00

I have a webservice which return this kind of json object : { dossiers:

  • 0

I have a webservice which return this kind of json object :

{

"dossiers": [
    {
        "id": "2"
    },
    {
        "id": "3"
    }
]
}

So I’m try to unserialize this answer in a POJO using jersey-client (v1.12).

So here is my current code :

DossiersPOJO.java

 @XmlRootElement( name = "dossiers" )
public class DossiersPOJO
{
    private List<DossierPOJO> dossiers;

    public List<DossierPOJO> getDossiers( )
    {
        return dossiers;
    }

    public void setDossiers( List<DossierPOJO> dossiers )
    {
        this.dossiers = dossiers;
    }
}

Dossier.java

public class DossierPOJO
{
    private Long id;

    public Long getId( )
    {
        return id;
    }

    public void setId( Long id )
    {
        this.id = id;
    }
}

And the client code itself :

WebResource siraWebResource = Client.create( ).resource(
                "http://localhost:8081/site/rest/path/resources" );

Builder accept = siraWebResource.accept( MediaType.APPLICATION_JSON_TYPE );
//        accept.accept( "application/json" );

DossiersPOJO dossierJson = accept.get( DossiersPOJO.class );

But when I call get I get this error stack :

log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).
log4j:WARN Please initialize the log4j system properly.
26 avr. 2012 17:18:03 com.sun.jersey.api.client.ClientResponse getEntity
GRAVE: A message body reader for Java class fr.paris.lutece.batches.ramen.bean.DossiersPOJO, and Java type class fr.paris.lutece.batches.ramen.bean.DossiersPOJO, and MIME media type application/json was not found
26 avr. 2012 17:18:03 com.sun.jersey.api.client.ClientResponse getEntity
GRAVE: The registered message body readers compatible with the MIME media type are:
*/* ->
  com.sun.jersey.core.impl.provider.entity.FormProvider
  com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
  com.sun.jersey.core.impl.provider.entity.StringProvider
  com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
  com.sun.jersey.core.impl.provider.entity.FileProvider
  com.sun.jersey.core.impl.provider.entity.InputStreamProvider
  com.sun.jersey.core.impl.provider.entity.DataSourceProvider
  com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
  com.sun.jersey.core.impl.provider.entity.ReaderProvider
  com.sun.jersey.core.impl.provider.entity.DocumentProvider
  com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceReader
  com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader
  com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader
  com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
  com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
  com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General
  com.sun.jersey.core.impl.provider.entity.EntityHolderReader

I can’t figure out where the problem come from since I know my client POJO are exactly similar to server side one.

  • 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-02T22:58:31+00:00Added an answer on June 2, 2026 at 10:58 pm

    Actually it was easier than I thought!
    In the first time my pom.xml contains only one dependency :

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>1.12</version>
    </dependency>
    

    And I found out that json to object conversion needs another dependency :

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-json</artifactId>
        <version>1.12</version>
    </dependency>
    

    And that it, adding this dependency is enought and now my project is able to handle json response and convert it to pojo object.

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

Sidebar

Related Questions

I have a webservice programmed in coldfusion which I'm attempting to consume using c#.net.
I have developed a webservice using Apache CXF ,which will be in production very
I have an ASMX webservice with a number of methods which will return XML.
I have an object which is the return value for a web service method.
I have webservice that can return data in multiple formats. For example json and
I have a method which requests external webservices and returns json here: public string
I have a restful webservice which receives some structured data which is put straight
I have a .NET webservice which I need to hit asynchronously from the jQuery
I have a webservice project (old asmx technology) in which I have a class
I have a winforms, and it connecting wit webservice. Webservice has method which create

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.