When will Spring MVC support Jackson 2.0?
http://jackson-users.ning.com/profil...2-0-0-released
When will Spring MVC support Jackson 2.0?
http://jackson-users.ning.com/profil...2-0-0-released
If you enable the mvc: namespace and Jackson is in the classpath It should be used by default.
Are you receiving some type of error?
- Manuel Jordan
Kill Your Pride, Share Your Knowledge With All
The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7
Blog
Technical Reviewer of Apress
- Pro SpringSource dm Server
- Spring Enterprise Recipes: A Problem-Solution Approach
- Spring Recipes: A Problem-Solution Approach, 2nd Edition
- Pro Spring Integration
- Pro Spring Batch
- Pro Spring 3
- Pro Spring MVC: With Web Flow
- Pro Spring Security
Doesn't seem to work when specifying custom ObjectMapper.
I get this exception when starting the server.Code:<mvc:annotation-driven> <mvc:message-converters> <bean id="jsonConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> <property name="objectMapper" ref="objectMapper" /> </bean> </mvc:message-converters> </mvc:annotation-driven> <bean id="objectMapper" class="com.test.webapp.util.HibernateAwareObjectMapper" />
Without <mvc:message-converters>, it works fine.Code:java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
Code:package com.test.webapp.util; public class HibernateAwareObjectMapper extends ObjectMapper { public HibernateAwareObjectMapper() { Hibernate4Module hm = new Hibernate4Module(); registerModule(hm); configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); } public void setPrettyPrint(boolean prettyPrint) { configure(SerializationFeature.INDENT_OUTPUT, prettyPrint); } }
I get the exception when starting the server.
But I'm using:Code:java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
It's because de changing os packages:Code:<bean id="methodHandlerExceptionResolver" class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver"> <property name="messageConverters"> <list> <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /> </list> </property> </bean>
http://wiki.fasterxml.com/JacksonRel..._Java_packages
Fun. I guess that means we can't use Jackson 2.0 until Spring 3.2. That's particularly annoying in the case of the jackson-datatype-hibernate4 module, which requires Jackson 2.0.
Hello
Seems correct, that is a huge problem when third parties changes its APII guess that means we can't use Jackson 2.0 until Spring 3.2
I suggest you create a JIRA issue here Spring's Issue Tracker
- Manuel Jordan
Kill Your Pride, Share Your Knowledge With All
The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7
Blog
Technical Reviewer of Apress
- Pro SpringSource dm Server
- Spring Enterprise Recipes: A Problem-Solution Approach
- Spring Recipes: A Problem-Solution Approach, 2nd Edition
- Pro Spring Integration
- Pro Spring Batch
- Pro Spring 3
- Pro Spring MVC: With Web Flow
- Pro Spring Security
I have JIRA issue created for MappingJacksonJsonView which is in a similar situation as MappingJacksonHttpMessageConverter in.
https://jira.springsource.org/browse/SPR-9302
Hi all,
I know this thread is a little old, but I just solved using Jackson 2.0 and Spring 3.1.1. My current setup is;
Spring 3.1.1
Hibernate 4.1
Jackson 2.0
First off, I found this blog post:
http://blog.pastelstudios.com/2012/0...ule-hibernate/
Second, I found this tweet:
https://gist.github.com/2423129
If you take the file from the tweet, and start from step 2 on the blog post, you should be all set.
Although not specifically mentioned by the OP, this will also solve the issue of trying to return hibernate entity objects with lazy associations via @ResponseBody and the jackson json mapper, which was my original problem.
HTH,
Thantous
Last edited by thantous; Jun 13th, 2012 at 01:17 PM. Reason: Added bit about hibernate