I am using Spring + Jersey to build an API service .
Recently , I try to incorporate Spring Data to my server .
I haven't truly use any Repositories in my running code , just add one line in my app.xml :
But ! I notice my API not working , complaining "A message body writer for Java class xxx , and Java type class xxx , and MIME media type application/json was not found"Code:<jpa:repositories base-package="destiny.web" entity-manager-factory-ref="entityManagerFactoryApp" />
If I remove the "jpa:repositories ..." line in my xml , everything works fine !
and , all provider classes are registered by spring :
But , if I add "jpa:repositories..." line in my XML , only "root resources class" are registered :Code:{http://*:8080-1} Registering Spring bean, apiResultJsonWriter, of type destiny.web.api.ApiResultJsonWriter as a provider class {http://*:8080-1} Registering Spring bean, webApi, of type destiny.web.api.WebApi as a root resource class {http://*:8080-1} Initiating Jersey application, version 'Jersey: 1.8 06/24/2011 12:17 PM'
I don't know if it is Spring-Data's bug ?Code:{http://*:8080-1} CDI support is enabled {http://*:8080-1} Using default applicationContext {http://*:8080-1} Registering Spring bean, webApi, of type destiny.web.api.WebApi as a root resource class {http://*:8080-1} Initiating Jersey application, version 'Jersey: 1.8 06/24/2011 12:17 PM'
And how to solve it ?
environment :
spring-3.1
jersey-core-1.8.jar
jersey-server-1.8.jar
jersey-spring-1.8.jar
spring-data-jpa-1.0.3.RELEASE.jar
spring-data-commons-core-1.1.0.RELEASE.jar
server : resin-4.0.25
Related dependencies :
( I tried to add jersey-json , but still not working )Code:<dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-server</artifactId> <version>1.8</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-spring</artifactId> <version>1.8</version> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-jpa</artifactId> <version>1.0.3.RELEASE</version> </dependency>


Reply With Quote
