• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RESTful service in Spring configuration with jackson-datatype-jsr310

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,

ObjectMapperContextResolver.java


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:

    pom.xml



    web.xml



    rest-servlet.xml



     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic