Monday, February 14, 2011

HttpMediaTypeNotAcceptableException

Using spring mvc and the @ResponseBody annotation might give you the HttpMediaTypeNotAcceptableException if you set the "Accept" header to "application/json". To solve this, add jackson-jaxrs to your classpath.  Nothing else needs to be done, spring does it's magic.

In your test , slap on a @Autowired on your AnnotationMethodHandlerAdapter.

Sunday, February 13, 2011

Maven + appengine

This memo is about using maven with your google appengine project.

Prerequisites:
Maven 3.0x
Command line interface
Know how to edit your pom

Howto:
  1. mvn archetype:generate choose gae-jsp and enter your project group/artifactid
  2. cd
  3. edit your pom.xml file to define at least the 1.4.2 version of google appengine, found under the properties tag. 1.4.2
  4. type mvn install to check that everything is ok
  5. type mvn gae:unpack to download and install the gae runtime into your local repository
  6. Edit the src/main/webapp/index.jsp, remove all jsp tags.
  7. type mvn gae:run and open localhost:8080
Congrats, you are now ready to start your GAE project with maven. I suggest
  1. mvn eclipse:eclipse and import the project into eclipse.
  2. Add spring, spring-mvc and spring-jdo or spring-jpa to your projects pom-file.

Update: updated version from 1.4.0 to 1.4.2