Integrating Jackson with Jersey for XML and JSON

26 views
Skip to first unread message

Francesco Xia

unread,
Nov 13, 2024, 8:21:34 AM11/13/24
to jackson-user

Hi everyone,

I initially posted a similar question on the Jersey GitHub discussion channel (1), but I haven't received a response, so I hope it's okay to ask here. I realize my question is more directly related to Jersey, but I thought some of you might have valuable insights, given how often open-source projects intersect with each other.

In our project, we’re currently using `org.glassfish.jersey.media:jersey-media-json-jackson` to provide support for JSON serialization, which works great.
Now we’re looking to add support for XML-based endpoints, but we’ve run into a bit of a roadblock and could use some guidance.

As far as we know, there isn’t a direct XML equivalent of `jersey-media-json-jackson`.
Since `jackson-jaxrs-providers` offers XML support, we thought we would write a JAX-RS feature using its XML provider, but this has led to having to deal with core classes being duplicated. The core classes are coming both from the shaded version in `jersey-media-json-jackson` and the regular `jackson-jaxrs-providers` xml module, like, for example, JacksonFeatures.java.

To avoid the complexity of managing duplicated classes, we’re considering rewriting our JSON feature to use the JSON provider from `jackson-jaxrs-providers` directly, simplifying the setup.

My questions would be:
- are updates to `jackson-jaxrs-providers` typically backported to `jersey-media-json-jackson`?
- could you provide some context around why the classes were shaded in `jersey-media-json-jackson`? Maybe there is something that we are overlooking.

I apologize if this is outside the usual scope of this group, but if anyone has any background and is willing to share it is much appreciate it!

Thank you for your time,
Francesco

References:
(1) https://github.com/eclipse-ee4j/jersey/discussions/5795

Joo Hyuk Kim

unread,
Nov 13, 2024, 9:00:50 AM11/13/24
to jackso...@googlegroups.com
I don't have any context on this subject matter, but both of your questions are on actions that seem to be driven by Jersey community, not Jackson.
If someone does have context, cool but, unfortunately I don't see much possibility here :-/

I suppose your best bet is to get the answer to your inquiry at Jersey Discussion channel or look for user groups channel somewhere.

Good luck!

--
You received this message because you are subscribed to the Google Groups "jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jackson-user/8ef015c8-e4e1-460c-bb9a-343437bd4698n%40googlegroups.com.

Tatu Saloranta

unread,
Nov 13, 2024, 2:47:35 PM11/13/24
to jackso...@googlegroups.com
On Wed, Nov 13, 2024 at 6:00 AM Joo Hyuk Kim <bean...@gmail.com> wrote:
>
> I don't have any context on this subject matter, but both of your questions are on actions that seem to be driven by Jersey community, not Jackson.
> If someone does have context, cool but, unfortunately I don't see much possibility here :-/
>
> I suppose your best bet is to get the answer to your inquiry at Jersey Discussion channel or look for user groups channel somewhere.
>
> Good luck!

+1 for that. Unfortunately Jersey maintainers do not collaborate with
us wrt JAX-RS provider at all. :-(
So we have no real visibility on what they do on their side.
I assume they do report bugs on Jackson components, but I do not even
know who maintains Jersey.
Would like to know, and would be happy to collaborate more.

-+ Tatu +-

>
> On Wed, Nov 13, 2024 at 10:21 PM 'Francesco Xia' via jackson-user <jackso...@googlegroups.com> wrote:
>>
>> Hi everyone,
>>
>> I initially posted a similar question on the Jersey GitHub discussion channel (1), but I haven't received a response, so I hope it's okay to ask here. I realize my question is more directly related to Jersey, but I thought some of you might have valuable insights, given how often open-source projects intersect with each other.
>>
>> In our project, we’re currently using `org.glassfish.jersey.media:jersey-media-json-jackson` to provide support for JSON serialization, which works great.
>> Now we’re looking to add support for XML-based endpoints, but we’ve run into a bit of a roadblock and could use some guidance.
>>
>> As far as we know, there isn’t a direct XML equivalent of `jersey-media-json-jackson`.
>> Since `jackson-jaxrs-providers` offers XML support, we thought we would write a JAX-RS feature using its XML provider, but this has led to having to deal with core classes being duplicated. The core classes are coming both from the shaded version in `jersey-media-json-jackson` and the regular `jackson-jaxrs-providers` xml module, like, for example, JacksonFeatures.java.
>>
>> To avoid the complexity of managing duplicated classes, we’re considering rewriting our JSON feature to use the JSON provider from `jackson-jaxrs-providers` directly, simplifying the setup.
>>
>> My questions would be:
>> - are updates to `jackson-jaxrs-providers` typically backported to `jersey-media-json-jackson`?
>> - could you provide some context around why the classes were shaded in `jersey-media-json-jackson`? Maybe there is something that we are overlooking.
>>
>> I apologize if this is outside the usual scope of this group, but if anyone has any background and is willing to share it is much appreciate it!
>>
>> Thank you for your time,
>> Francesco
>>
>> References:
>> (1) https://github.com/eclipse-ee4j/jersey/discussions/5795
>>
>> --
>> You received this message because you are subscribed to the Google Groups "jackson-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user...@googlegroups.com.
>> To view this discussion visit https://groups.google.com/d/msgid/jackson-user/8ef015c8-e4e1-460c-bb9a-343437bd4698n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/jackson-user/CALS-ipyEoKeXziM8q_N7mPa%3DUYAE6mDcuBOfs1kP8hArtyDwBw%40mail.gmail.com.

Tatu Saloranta

unread,
Nov 13, 2024, 2:53:16 PM11/13/24
to jackso...@googlegroups.com
On Wed, Nov 13, 2024 at 11:47 AM Tatu Saloranta <tsalo...@gmail.com> wrote:
>
> On Wed, Nov 13, 2024 at 6:00 AM Joo Hyuk Kim <bean...@gmail.com> wrote:
> >
> > I don't have any context on this subject matter, but both of your questions are on actions that seem to be driven by Jersey community, not Jackson.
> > If someone does have context, cool but, unfortunately I don't see much possibility here :-/
> >
> > I suppose your best bet is to get the answer to your inquiry at Jersey Discussion channel or look for user groups channel somewhere.
> >
> > Good luck!
>
> +1 for that. Unfortunately Jersey maintainers do not collaborate with
> us wrt JAX-RS provider at all. :-(
> So we have no real visibility on what they do on their side.
> I assume they do report bugs on Jackson components, but I do not even
> know who maintains Jersey.
> Would like to know, and would be happy to collaborate more.

Forgot to mention: I think shading of Jackson classes is due to
version conflicts wrt users deploying Jersey, wanting to use different
versions.
But it gets really tricky for multiple reasons, including problems you mention.

-+ Tatu +-
> To view this discussion visit https://groups.google.com/d/msgid/jackson-user/CAGrxA24n8Jxd4yZhBY-5bQQ-XjapR7JUE09i_aFrk3sRrbSgSQ%40mail.gmail.com.

Francesco Xia

unread,
Nov 17, 2024, 5:56:23 PM11/17/24
to jackson-user
Thank you for getting back to me.
I'll continue exploring on the Jersey side.
In the meantime, If anyone does have any insights, feel free to reach out to me directly.

Have a nice weekend,
Francesco
Reply all
Reply to author
Forward
0 new messages