Jersey client - unmarshall a ClientResponse entity body of type XML to a POJO
===

I've read through a lot of the examples here and I still can't isolate my coding mistake. I'm trying to use the built-in Jersey-client MessageBodyReaders.

My pojo looks like this:

    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {"name", "complexId", "libraryList", "partitionList", "nextLinks"})
    @XmlRootElement(name = "LibraryComplex")

    public class YapiLibraryComplex 
    {
        @XmlTransient LibraryComplex libComplex;
        String name;
        int complexId;
        List<Integer> libraryList;
        List<String> partitionList;
        List<URI> nextLinks;
             .
             .
             .

my service looks like this:

    @Path ("/")
    public class YAPIWebService
    {
        @Context Application yapiAppl;
        @Context UriInfo uriInfo;


        @GET
        @Produces ("application/xml")
        //@Produces ("MediaType.APPLICATION_XML")
        public Response getLibraryComplex()
        {
            LibraryComplex libComplex = (((YAPIapplication) yapiAppl).getLibComplex());
            YapiLibraryComplex yapiLibPlex;
                .
                .
                .
        
            return Response.ok(yapiLibPlex).build();


and my client:

    public static void main(String[] args) 
    {   //client client = new client();
        System.out.println("the beginning");
        //ClientConfig cc = new DefaultClientConfig();
        //cc.getClasses().add(com.sun.jersey.api.core.);
        //Client c = Client.create(cc);
        Client c = Client.create();
        WebResource rsrc = c.resource("http://localhost:7101/");
        //ClientResponse response = rsrc.get(ClientResponse.class);

        ClientResponse response = rsrc.accept(MediaType.APPLICATION_XML).get(ClientResponse.class);

        YapiLibraryComplex libPlex = response.getEntity(YapiLibraryComplex.class);
        System.out.println("the libPlex object is " + libPlex.toString());
        
        String entityBody = response.getEntity(String.class);
        System.out.println("the response as a string is " + entityBody);
        System.out.println("the status is " + response.getStatus());
        System.out.println("the links are " + response.getLinks());

        System.out.println("the end");
    }
}

And my stack trace:

the beginning 

Jul 25, 2012 6:47:22 PM com.sun.jersey.core.impl.provider.xml.SAXParserContextProvider getInstance WARNING: JAXP feature XMLConstants.FEATURE_SECURE_PROCESSING cannot be set on a SAXParserFactory. External general entity processing is disabled but other potential security related features will not be enabled. org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing 	at oracle.xml.jaxp.JXSAXParserFactory.setFeature(JXSAXParserFactory.java:129)

	at com.sun.jersey.core.impl.provider.xml.SAXParserContextProvider.getInstance(SAXParserContextProvider.java:80)

	at com.sun.jersey.core.impl.provider.xml.SAXParserContextProvider.getInstance(SAXParserContextProvider.java:54)

	at com.sun.jersey.core.impl.provider.xml.ThreadLocalSingletonContextProvider$1.initialValue(ThreadLocalSingletonContextProvider.java:64)

	at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:141)

	at java.lang.ThreadLocal.get(ThreadLocal.java:131)

	at com.sun.jersey.core.impl.provider.xml.ThreadLocalSingletonContextProvider$2.getValue(ThreadLocalSingletonContextProvider.java:77)

	at com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider.readFrom(XMLRootElementProvider.java:113)

	at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.readFrom(AbstractRootElementProvider.java:111)

	at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:554)

	at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:506)

	at .tape.acs.yapi.smokeTest.main(smokeTest.java:32) Exception in thread "main" javax.ws.rs.WebApplicationException: javax.xml.bind.JAXBException: Error creating SAXSource - with linked exception: [org.xml.sax.SAXNotSupportedException: SAX feature 'http://xml.org/sax/features/external-general-entities' not supported.]

	at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.readFrom(AbstractRootElementProvider.java:115)

	at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:554)

	at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:506)

	at .tape.acs.yapi.smokeTest.main(smokeTest.java:32) Caused by: javax.xml.bind.JAXBException: Error creating SAXSource - with linked exception:[org.xml.sax.SAXNotSupportedException: SAX feature 'http://xml.org/sax/features/external-general-entities' not supported.]

	at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getSAXSource(AbstractJAXBProvider.java:205)

	at com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider.readFrom(XMLRootElementProvider.java:113)

	at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.readFrom(AbstractRootElementProvider.java:111)

	... 3 more Caused by: org.xml.sax.SAXNotSupportedException: SAX feature 'http://xml.org/sax/features/external-general-entities' not supported.

	at oracle.xml.parser.v2.NonValidatingParser.setFeature(NonValidatingParser.java:1975)

	at oracle.xml.parser.v2.SAXParser.setFeature(SAXParser.java:270)

	at oracle.xml.jaxp.JXSAXParserFactory.newSAXParser(JXSAXParserFactory.java:92)

	at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getSAXSource(AbstractJAXBProvider.java:201)

	... 5 more Process exited with exit code 1.