Hi,

Could you double check that Jackson provider jars are on the classpath?

Regards,
Andrei.

> -----Original Message-----
> From: David Karlsen [mailto:[email protected]]
> Sent: Freitag, 13. Februar 2015 11:07
> To: [email protected]
> Subject: Problem marshalling responses when using LocalTransport for
> intgration testing
> 
> Hi.
> 
> I'm using the localtransport to do integration testing of my JAX-RS resources.
> 
> I setup the server like this:
> 
> private <T> void setupResource( T resource ) {
>     try
>     {
>         PropertyUtils.setProperty( resource, "contextHolder", contextHolder );
>     }
>     catch ( Exception e ) {
>         logger.warn( "No property for setting contextHolder", e );
>     }
> 
>     JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
> 
>     List<Object> providers = new ArrayList<>();
>     providers.add( new JacksonJaxbJsonProvider() );
>     providers.add( new ServiceExceptionMapper() );
>     //providers.add( new ContextHolder() ); //?
>     sf.setProviders( providers );
> 
>     sf.setResourceClasses( resource.getClass() );
>     sf.setResourceProvider( resource.getClass(),
>         new SingletonResourceProvider( resource, true ));
>     sf.setAddress( ENDPOINT_ADDRESS );
> 
>     server = sf.create();
> }
> 
> 
> And get my client like this:
> 
> protected <T> T getClientProxy( Class<T> resourceClass ) {
>     T client = JAXRSClientFactory.create( ENDPOINT_ADDRESS,resourceClass );
>     WebClient.getConfig( client )
>         .getRequestContext().put( LocalConduit.DIRECT_DISPATCH,
> Boolean.TRUE);
> 
>     return client;
> }
> 
> 
> Invocation is OK on the server side, but when it's about to marshal the 
> response
> it says:
> 
> No message body reader has been found for class <myPojo>, ContentType:
> application/json
> 
> 
> even though I've set the JacksonJaxbJsonProvider in the provider list.
> 
> When running a standalone server in a servlet-container it works just fine.
> What am I missing?
> 
> 
> 
> --
> --
> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen

Reply via email to