DW4 JacksonJaxbJsonProvider, javax and jakarta...

631 views
Skip to first unread message

Jonathan Olsson

unread,
Apr 14, 2023, 7:23:49 AM4/14/23
to dropwizard-user
Hi!

I'm enjoying my time upgrading from DW 2.1.5 to DW 4.0.0 and am having some issues related to the Jackson dependency. DW 4.0.0 uses jackson 2.14.2. The JacksonJaxbJsonProvider still uses javax.ws.rs and not jakarta leading to some issues with the following snipppet:

val om = Json.configureObjectMapper(environment.objectMapper)
val jsonProvider = JacksonJaxbJsonProvider()
jsonProvider.setMapper(om)

When compiling I get the following error when trying to setMapper:

e: file:///... Cannot access 'javax.ws.rs.ext.MessageBodyReader' which is a supertype of 'com.fasterxml.jackson.jaxrs.base.ProviderBase'. Check your module classpath for missing or conflicting dependencies

Any way to get around this besides pulling in old javax dependencies?

Thankful for any help.

Tatu Saloranta

unread,
Apr 14, 2023, 2:24:42 PM4/14/23
to dropwiz...@googlegroups.com
Due to the Hot Mess that the Javax-to-Jakarta transformation is,
Jackson provides separate sets of things for 2.
Old Javax-variants have a consistent set of dependencies and will not
be changed to use Jakarta.
What you need is new provider from
https://github.com/FasterXML/jackson-jakarta-rs-providers/ (package
`jackson-jakarta-rs-json-provider`; and provider class
`JacksonXmlBindJsonProvider` if wanting to use JAXB-ish annotations;
otherwise `JacksonJsonProvider`).

Since this is through DropWizard, not sure if you need to do anything else

-+ Tatu +-

>
> --
> You received this message because you are subscribed to the Google Groups "dropwizard-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dropwizard-user/2936ef6b-1e62-45ff-b178-f4ab71dee6c5n%40googlegroups.com.

Jonathan Olsson

unread,
Apr 15, 2023, 5:34:23 PM4/15/23
to dropwizard-user
Thanks for the help, this solved my problem!
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages