Hi Chege, The user list is the better place for questions like this. Quick tip though, try creating a small sample using the recently released Johnzon 1.2.19. I've also found the error messages to be not helpful and spent a month auditing and reworking them all. Hopefully we can get that into a TomEE release soon.
Let me know if the issue is more obvious with the new messages -- that would make my day :) Of course, if it's still not obvious, let me know and I'll see what can be improved. -- David Blevins http://twitter.com/dblevins http://www.tomitribe.com > On Aug 23, 2022, at 6:59 AM, chege <ch...@programmer.net> wrote: > > Hi, > > I have a simple use case where I want convert json to pojo. > All values are quoted including booleans, longs and ints. > Jsonb specification says parse$Type e.g parseInt > or > parseBoolean shall be used. These methods can take string arguments. > > https://jakarta.ee/specifications/jsonb/3.0/jakarta-jsonb-spec-3.0.html#java-lang-byte-short-integer-long-float-double > > I have a unit test that produces the error. > > > javax.json.bind.JsonbException: Missing a Converter for type int to convert > the JSON String '20' . Please register a custom converter for it. > at ke.mbote.jsonb.ClientTest.test(ClientTest.java:23) > Caused by: org.apache.johnzon.mapper.MapperException: Missing a Converter for > type int to convert the JSON String '20' . Please register a custom converter > for it. > at ke.mbote.jsonb.ClientTest.test(ClientTest.java:23) > > > The test can be found athttps://github.com/chegekinuthia/jsonbissue.git > > > @Named > public class Client { > > @Inject > private Jsonb jsonb; > > public Book getBook() { > String book = "{\"id\":\"20\",\"published\":\"true\"}"; > return jsonb.fromJson(book, Book.class); > > } > > } > > > @Classes(cdi = true, value = {Client.class, Book.class, Config.class}) > @RunWith(org.apache.openejb.junit.ApplicationComposer.class) > public class ClientTest extends TestCase { > > @Inject > private Client client; > > @Test > public void test() throws Exception { > > Book book = client.getBook(); > assertEquals(20, book.getId()); > assertTrue(book.isPublished()); > > } > } > > What am I missing?
smime.p7s
Description: S/MIME cryptographic signature