This week's book giveaway is in the Testing forum.
We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line!
See this thread for details.
Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RESTful service in Spring configuration with jackson-datatype-jsr310

RichardH Marais
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I am trying to configure a Java 8 & Spring 4.3.1 app to use RESTful services.  I get it to work perfectly with the config below, until I introduce a ContextResolver. The reason for the ContextResolver is because I need to format a to JSON.

I first tried with annotations on my model bean by adding the @JsonFormat,

and got the following error:

java.lang.NoSuchMethodError: com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase.findFormatOverrides(Lcom/fasterxml/jackson/databind/SerializerProvider;Lcom/fasterxml/jackson/databind/BeanProperty;Ljava/lang/Class;)Lcom/fasterxml/jackson/annotation/JsonFormat$Value;

Secondly, I removed the @JsonFormat annotation and tried with a ContextResolver,

and got the following error:

[org.springframework.web.servlet.PageNotFound] (default task-4) No mapping found for HTTP request with URI [/jbosswildfly/employee/list] in DispatcherServlet with name 'rest'

Please can someone advise, I think my Spring configuration may not be correct.
  • In the first case, with the @JsonFormat annotation, the request hits the RESTful service, but gets a NoSuchMethodError suggesting my dependencies are not correct.
  • The second case, with the ContextResolver, the request doesn't find the DispatcherServelet (and hence doesn't reach the RESTful service). This suggests my Spring config is incorrect.

  • As I said, if I don't use the @JsonFormat annotation or the ContextResolver, I can call the RESTful service successfully (but I need to format the dates).

    Thank you

    My config as as follows:




    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic