Skip to content

Comments

O3-5254: Exclude jackson-dataformat-yaml to prevent bundling Jackson dataformat#689

Merged
dkayiwa merged 3 commits intoopenmrs:masterfrom
jayasanka-sack:O3-5254
Dec 5, 2025
Merged

O3-5254: Exclude jackson-dataformat-yaml to prevent bundling Jackson dataformat#689
dkayiwa merged 3 commits intoopenmrs:masterfrom
jayasanka-sack:O3-5254

Conversation

@jayasanka-sack
Copy link
Member

@jayasanka-sack jayasanka-sack commented Dec 4, 2025

Description of what I changed

This PR excludes jackson-dataformat-yaml from the swagger-core dependency in webservices.rest-omod-common. The module was previously bundling its own Jackson YAML library inside the OMOD, which contributed to classloader constraint violations when OpenMRS starts.

Issue I worked on

see https://openmrs.atlassian.net/browse/O3-5254

Checklist: I completed these to help reviewers :)

  • My IDE is configured to follow the code style of this project.

    No? Unsure? -> configure your IDE, format the code and add the changes with git add . && git commit --amend

  • I have added tests to cover my changes. (If you refactored
    existing code that was well tested you do not have to add tests)

    No? -> write tests and add them to this commit git add . && git commit --amend

  • I ran mvn clean package right before creating this pull request and
    added all formatting changes to my commit.

    No? -> execute above command

  • All new and existing tests passed.

    No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.

  • My pull request is based on the latest changes of the master branch.

    No? Unsure? -> execute command git pull --rebase upstream master

The webservices.rest-omod-common module was packaging
`jackson-dataformat-yaml` via swagger-core, which resulted in Jackson
artifacts being included in the OMOD. This contributed to classloader
conflicts during OpenMRS startup (LinkageError: ObjectReader), especially
when demo data generation is enabled.

By excluding jackson-dataformat-yaml, the module now defers to the
Jackson version provided by the platform/container, preventing duplicate
Jackson classes from being shipped inside the OMOD.
@dkayiwa
Copy link
Member

dkayiwa commented Dec 4, 2025

@jayasanka-sack do you still have the exact class loader error message in the logs?

@jayasanka-sack jayasanka-sack changed the title O3-5254: Exclude jackson-dataformat-yaml to prevent bundling Jackson O3-5254: Exclude jackson-dataformat-yaml to prevent bundling Jackson dataformat Dec 4, 2025
@jayasanka-sack
Copy link
Member Author

Hi Daniel, yes I checked the error is now gone ❤️

It is still safe to exclude jackson-dataformat-yaml because the REST module does not depend on YAML serialization for any of its functionality. Swagger and the REST APIs operate entirely on JSON, which is already handled by the Jackson libraries provided by OpenMRS Core.

Keeping this dataformat dependency inside the OMOD would re-introduce a separate Jackson artifact into the module classpath, which is exactly the pattern that led to the initial classloader conflict.

If YAML support is needed in the future, it should be added at the platform level rather than packaged inside an OMOD.

matrix:
platform: [ ubuntu-latest ]
java-version: [ 8, 11, 17, 21 ]
fail-fast: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to the PR, but GitHub rolled out an update to GitHub Action matrices to fail-fast by default. This means that if one job in the matrix fails, it will skip all the in-progress jobs. I noticed the same issue on this PR while working on it, so I turned it off. This way for example if the Java 8 job fails, it won’t stop running jobs for other Java versions.

I did the same for the distro: openmrs/openmrs-distro-referenceapplication#947

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 👍

@dkayiwa dkayiwa merged commit 92d4f8f into openmrs:master Dec 5, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants