Hi What is your model?
Did you try @JohnzonConverter too? Tomee uses an old johnzon too so can need some enhancements from master. Le 14 oct. 2017 03:10, "Paul Carter-Brown" <paul.carter-br...@smilecoms.com> a écrit : > Hi, > > I've created an adapter as follows: > > public class JavascriptDate implements Adapter<String, Instant> { > > @Override > public String to(Instant instance) { > final Calendar cal = GregorianCalendar.getInstance(); > cal.setTime(Date.from(instance)); > return DatatypeConverter.printDateTime(cal); > } > > @Override > public Instant from(String text) { > return DatatypeConverter.parseDateTime(text).getTime(). > toInstant(); > } > } > > and register it globally like this in a servlet init: > > new MapperBuilder().addAdapter(new JavascriptDate()).build(); > > When I call a rest service passing a date formatted string field that needs > to map to an Instant I get an error: > > org.apache.johnzon.mapper.MapperException: Using fallback converter, this > only works in write mode but not in read. Please register a custom > converter to do so. > at > org.apache.johnzon.mapper.MappingParserImpl$FallbackConverter.fromString( > MappingParserImpl.java:715) > at org.apache.johnzon.mapper.internal.ConverterAdapter.to > (ConverterAdapter.java:37) > at org.apache.johnzon.mapper.internal.ConverterAdapter.to > (ConverterAdapter.java:24) > at > org.apache.johnzon.mapper.MappingParserImpl.convertTo( > MappingParserImpl.java:682) > at > org.apache.johnzon.mapper.MappingParserImpl.toObject( > MappingParserImpl.java:523) > at > org.apache.johnzon.mapper.MappingParserImpl.toValue( > MappingParserImpl.java:634) > at > org.apache.johnzon.mapper.MappingParserImpl.buildObject( > MappingParserImpl.java:318) > at > org.apache.johnzon.mapper.MappingParserImpl.readObject( > MappingParserImpl.java:133) > > > Any ideas why my mapper is not being used? > > Thanks > Paul > > -- > > > This email is subject to the disclaimer of Smile Communications at > http://www.smilecoms.com/home/email-disclaimer/ <http://www.smilecoms.com/ > disclaimer> > >