• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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



     
    Seriously Rick? Seriously? You might as well just read this tiny ad:
    Free, earth friendly heat - from the CodeRanch trailboss
    https://www.kickstarter.com/projects/paulwheaton/free-heat
    reply
      Bookmark Topic Watch Topic
    • New Topic