Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure service bus jar changing default Spring Boot behavior #416

Open
RobOhRob opened this issue Sep 22, 2021 · 9 comments
Open

Azure service bus jar changing default Spring Boot behavior #416

RobOhRob opened this issue Sep 22, 2021 · 9 comments

Comments

@RobOhRob
Copy link

RobOhRob commented Sep 22, 2021

I am currently using Spring Boot version 2.1.3.RELEASE with version 7.1.0 of Azure service bus.

implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.1.0'
Simply adding the line above to my build.gradle script alters default Spring Boot behavior. Hitting a GET endpoint without any Accept header specified is returning XML instead of JSON and creating a RestTemplate now has a bunch of different Accept types. This is causing existing legacy code to break. It appears to be an issue with all versions of azure-messaging-servicebus after it was moved to the new package.

It appears that the issue is the jackson-dataformat-xml package that comes along with the jar. Excluding this package from the build returns to normal behavior. I am not sure if this is an issue with how you guys are packaging the library or if it is an issue with Spring just automatically consuming it.

Actual Behavior

  1. Hitting a GET endpoint with no Accept type specified defaults to application/xml being returned
  2. Creating a new RestTemplate() defaults the Accept types in the template to [application/xml, text/xml, application/json, application/+xml, application/+json]

Expected Behavior

  1. Hitting a GET endpoint with no Accept type specified defaults to application/json being returned
  2. Creating a new RestTemplate() defaults the Accept types in the template to [application/json, application/*+json]

Versions

  • OS platform and version: Mac OSX 10.15.7
  • Maven package version or commit ID: implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.1.0'
@KnyGoo
Copy link

KnyGoo commented Apr 14, 2022

Experiencing the same issues...

MappingJackson2XmlHttpMessageConverter is added to our resttemplate after including Azure Service Bus library...This is because Spring will add it to resttemplate when there exists an XmlMapper.class...

@edwinjames07
Copy link

Issue still exists in the latest version(7.8.0)

@KnyGoo @RobOhRob Have you got any solution for this?

@RobOhRob
Copy link
Author

Issue still exists in the latest version(7.8.0)

@KnyGoo @RobOhRob Have you got any solution for this?

Exclude the jackson-dataformat-xml package from the service bus package in the gradle or pom

@dhyanivikas
Copy link

@RobOhRob What do you specifically mean when you mention "Exclude the jackson-dataformat-xml package from the service bus package in the gradle or pom" ?
We have included only following in our gradle:
implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.1.0'
There's no specific dependency mentioned for jackson-dataformat-xml

@conniey
Copy link
Member

conniey commented Aug 2, 2022

Hey.

azure-messaging-servicebus depends on azure-core, which has a dependency on jackson-dataformat-xml (https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core/pom.xml#L114-L118).

The endpoints used by ServiceBusAdministrationClient and ServiceBusAdministrationAsyncClient return/consume XML. However, if you are not going to use those clients, you can exclude jackson-dataformat-xml.

@conniey
Copy link
Member

conniey commented Aug 2, 2022

I moved the bug to our repository. This repo references our legacy library.

@dhyanivikas
Copy link

We have already tried the exclusion option in following two ways:

compile (group: 'com.azure', name: 'azure-core', version: '1.18.0') {
exclude group: 'com.fasterxml.jackson.dataformat', module: 'jackson-dataformat-xml'
}
And
configurations.implementation {
exclude group: 'com.fasterxml.jackson.dataformat', module: 'jackson-dataformat-xml'
}

And then the application fails at the receiver startup.

@ki1729
Copy link

ki1729 commented Oct 31, 2022

@RobOhRob, @dhyanivikas : the problematic jackson xml library has been made an optional dependency. This should fix the issue. Please let us know if that is not the case.

@lemontagnolli
Copy link

lemontagnolli commented Apr 26, 2023

i had the same problem. Thanks. These comments helped me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants